Skip to content

fix: support label node in compact text input#293

Merged
hcopp merged 18 commits intomasterfrom
hunter/text-input-compact-label-node
Jan 16, 2026
Merged

fix: support label node in compact text input#293
hcopp merged 18 commits intomasterfrom
hunter/text-input-compact-label-node

Conversation

@hcopp
Copy link
Copy Markdown
Contributor

@hcopp hcopp commented Jan 8, 2026

What changed? Why?

This PR brings support for labelNode to TextInput for cases of labelVariant='inside' and compact.

Root cause (required for bugfixes)

We only used labelNode in the default case and not when considering compact or labelVariant inside.

UI changes

iOS Old iOS New

These examples weren't all on the doc site previously, but if a user tried it out this is what they would see

Web Old Web New
image image

Testing

How has it been tested?

  • Unit tests
  • Interaction tests
  • Pseudo State tests
  • Manual - Web
  • Manual - Android (Emulator / Device)
  • Manual - iOS (Emulator / Device)

Testing instructions

Illustrations/Icons Checklist

Required if this PR changes files under packages/illustrations/** or packages/icons/**

  • verified visreg changes with Terran (include link to visreg run/approval)
  • all illustration/icons names have been reviewed by Dom and/or Terran

Change management

type=routine
risk=low
impact=sev5

automerge=false

@hcopp hcopp self-assigned this Jan 8, 2026
@cb-heimdall
Copy link
Copy Markdown
Collaborator

cb-heimdall commented Jan 8, 2026

✅ Heimdall Review Status

Requirement Status More Info
Reviews 1/1
Denominator calculation
Show calculation
1 if user is bot 0
1 if user is external 0
2 if repo is sensitive 0
From .codeflow.yml 1
Additional review requirements
Show calculation
Max 0
0
From CODEOWNERS 1
Global minimum 0
Max 1
1
1 if commit is unverified 0
Sum 1
CODEOWNERS ✅ See below

CODEOWNERS

Code Owner Status Calculation
ui-systems-eng-team 1/1
Denominator calculation
Additional CODEOWNERS Requirement
Show calculation
Sum 0
0
From CODEOWNERS 1
Sum 1

function DatePicker() {
return <TextInput label="Pick a date" type="date" />;
}
```
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We already have a DatePicker component. All the examples I removed felt unhelpful and sometimes were for the wrong platform

@hcopp hcopp marked this pull request as ready for review January 12, 2026 18:33
paddingEnd={2}
paddingStart={start ? 0.5 : 2}
paddingTop={1}
>
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The goal here was to have us handle the padding as best as possible so that a customer can simply use InputLabel and it all works.

However for inside label variant on web and mobile with labelNode we do need to remove vertical padding on the examples to get it to match design.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do you think customer would ever need to override this part when using labelNode and labelVariant === 'inside'?

<Box
  background={readOnlyInputBackground}
  paddingEnd={2}
  paddingStart={start ? 0.5 : 2}
  paddingTop={1}
>

If they want to override it, I wonder if we should expose some styles/classNames props for it? If you think the use case is not strong enough or can be overridden in other ways, I think the current way is fine.

ref={ref}
aria-describedby={accessibilityHint}
aria-label={accessibilityLabel}
aria-labelledby={accessibilityLabelledBy}
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Was getting this react error in dev mode

react-dom.development.js:86 Warning: React does not recognize the `accessibilityLabelledBy` prop on a DOM element. If you intentionally want it to appear in the DOM as a custom attribute, spell it as lowercase `accessibilitylabelledby` instead. If you accidentally passed it from a parent component, remove it from the DOM element.

{label}
</InputLabel>
)}
</Box>
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Our mobile inputs are primarily based on set heights, but web height is more intrinsic, based on the height of the label, input, and added padding. However I found that react-native has known issues with lineHeight which prevents us from simplifying mobile facebook/react-native#39145

This is inside of NativeInput and InputStack not TextInput but mentioning since it caused me some headaches when trying to simplify our inputs.

@@ -91,10 +91,11 @@ It's also advised you always format `helperText` with `Error: ${errorMessage}`.
<TextInput label="Label" placeholder="Placeholder" />
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice revamp on the examples!

paddingEnd={2}
paddingStart={start ? 0.5 : 2}
paddingTop={1}
>
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do you think customer would ever need to override this part when using labelNode and labelVariant === 'inside'?

<Box
  background={readOnlyInputBackground}
  paddingEnd={2}
  paddingStart={start ? 0.5 : 2}
  paddingTop={1}
>

If they want to override it, I wonder if we should expose some styles/classNames props for it? If you think the use case is not strong enough or can be overridden in other ways, I think the current way is fine.

@hcopp
Copy link
Copy Markdown
Contributor Author

hcopp commented Jan 16, 2026

If they want to override it, I wonder if we should expose some styles/classNames props for it? If you think the use case is not strong enough or can be overridden in other ways, I think the current way is fine.

I could see customers wanting to customize this in the future but right now our inputs are not customizable at all really, can't even fully customize the border color let alone padding. I tried adding styles/classNames before but there was too many sub components that I think we should refactor/simplify before committing to them longterm.

At least with the value being based on padding they can adjust their themevars.space to adjust the component height!

@hcopp hcopp merged commit 52c129e into master Jan 16, 2026
28 checks passed
@hcopp hcopp deleted the hunter/text-input-compact-label-node branch January 16, 2026 21:58
cb-ekuersch pushed a commit that referenced this pull request Jan 30, 2026
* fix: support label node in compact text input

* Cleanup inside label variant

* Add examples

* Cleanup docs

* Undo example change

* Revert mobile changes

* Support labelNode in compact

* Fix example

* Fix inside label variant

* Bump version

* Update examples

* Fix a11y issue

* Add more tests
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Development

Successfully merging this pull request may close these issues.

3 participants