feat(components): add size prop to Input - #1953
Conversation
Add small (24px) and medium (32px, default) sizes to Input, matching the corresponding Button sizes so inputs and buttons align side by side. `size` now refers to the design-system scale, replacing the rarely-used native numeric HTML `size` attribute. Adds a dedicated Input story (Default/Sizes/Variants) modeled on Label's primitive story. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
🦋 Changeset detectedLatest commit: b5dbec3 The changes in this PR will be included in the next version bump. This PR includes changesets to release 1 package
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
commit: |
No gonfalon consumers set a numeric `size` on Input, so the size-scale change has no real-world migration impact. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Picker triggers (DatePicker, DateRangePicker, Select) set `size: null` and rely on the `picker` variant composing Input's `.base` for their font and vertical padding. Moving those into Input's size classes collapsed the triggers to ~20px. Compose Input's `medium` size into `.picker` so it renders as a medium-height input again. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
|
should we run a gonfalon meticulous test just to make sure? |
thanks for the suggestion @nhironaka! Meticulous reports no diff in Gonfalon PR |
The Input size refactor moved font + vertical padding out of `.base` into per-size classes, collapsing picker triggers (which compose only `.base`) to ~20px. Instead of patching the `.picker` class in Button.module.css, apply the default (medium) sizing on Input's `.base` and let `.small` override it. Picker triggers keep their medium height with no Button-file change, and the redundant `.medium` class is removed. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
| font: var(--lp-text-body-2-regular); | ||
| color: var(--lp-color-text-ui-primary-base); | ||
| padding: 5px var(--lp-spacing-300); | ||
| padding-block: 5px; |
There was a problem hiding this comment.
Any reason not to use tokens here and the 3px below?
There was a problem hiding this comment.
okay somewhat fixed (there is no 5px token). Fixed height would probably work better / not require odd padding
There was a problem hiding this comment.
yeah, agreed about fixed height -- less math to do when we come back to this...
The size scale has no size.5 token (it jumps from 4 to 6), so var(--lp-size-5) never resolved and medium inputs lost their block padding. Restore the 5px literal. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Switch Input's shared .base from a fixed height to min-height so the 32px/24px sizes act as a floor rather than a cap. TextArea reuses .base, so a fixed height was capping multiline fields at 32px; a min-height lets them grow with content while keeping the medium-input-height floor. Restore the textarea's block padding that base no longer sets. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
InputVariants now includes `size`, and TextArea/Group extend it but only style `variant` while spreading the rest of their props to the DOM — so a `size` value was neither styled nor stripped and could reach the element. Omit `size` from their prop types (neither has size variants) and pull `variant` out of the DOM spread, matching Input's pattern. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Input's min-height (32px) lives on the shared .base, which applies both to the Group container and to the field nested inside it. Group strips the nested field's padding/border but not its min-height, so the inner field was pinned to 32px, pushing button-Groups to 40px (32 + 6px padding + 2px border). Reset min-height on nested fields so the Group's own height governs, restoring 32px. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes using default effort and found 1 potential issue.
There are 2 total unresolved issues (including 1 from previous review).
❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, have a team admin enable autofix in the Cursor dashboard.
Reviewed by Cursor Bugbot for commit 6f2ff99. Configure here.
| .area { | ||
| flex: unset; | ||
| /* +1 to align with input elements who are granted a 1px useragent buffer */ | ||
| padding-block: calc(var(--lp-size-4) + var(--lp-size-1)); |
There was a problem hiding this comment.
This replaces the 5px that Input used to apply - it was composed into TextArea. min-height on Input now replaces the math which included the padding.
There was a problem hiding this comment.
context: this Multi Line story regressed due to the Input composition. I'm still testing with meticulous to not regress any of the composed fields (Group, Button, TextArea). Added some storybook examples for better coverage
…ker from Input The picker Button variant composed Input's `.base` directly, so Input's internal styles were an implicit contract for Button — every Input sizing change rippled into the picker and each size had to be re-bridged by hand. Move the shared field-shell styling into a neutral field.module.css that Input, TextArea, Group, and the picker all compose. Button no longer depends on Input's styles. The small-picker height bridge moves from a `.picker.small` CSS patch into Button.tsx (`variant === 'picker' && size === 'small'`), which also avoids the `size: null` (Select-injected) collapse a size-keyed lookup would hit. Add a Sizes story to Select showing small (24px) and medium (32px) triggers, covering the small-picker path that previously had no snapshot. Verified in Storybook: Input 24/32, Select trigger 32 (default) and 24 (small), Group 32, multiline TextArea still grows. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>


The purpose is to support the latest designs for list page filtering.
Summary
Adds a
sizeprop toInputwithsmallandmediumvariants, mirroringButton's size scale so inputs and buttons align when placed side by side.small→ 24px tall (text-small-1-regular, 11px text, 3px block padding) — matchesButtonsmall.medium→ 32px tall (text-body-2-regular, 5px block padding) — the default, unchanged from prior behavior; matchesButtonmedium.font+ vertical padding moved from.baseinto.small/.mediumclasses inInput.module.css; horizontal padding and everything else stay in.base.sizeisOmitted from the underlying React Aria props (the native numericsizeHTML attribute) and redefined as the design-system scale.size/variantare also no longer forwarded to the DOM<input>(RAC'sInputspreads unknown props unfiltered), which additionally fixes a pre-existing leak ofvariantto the DOM.Input.stories.tsx(Default/Sizes/Variants) modeled onLabel's primitive story — thesizeprop is documented there, whileTextField's stories keep covering Input in a composed field. No overlap withTextField's existing state matrix.Points for reviewer judgment
smalluses 11px text. That's the only way to hitButton's 24px small height with regular weight (there's no 13px/16px-line-height token). Flagging in case design expected 13px.minor. By the letter of the repo's bump rules, dropping the native numericsizeattribute is a "breaking type" (major). In spirit it's additive (repurposing a near-unused attribute). Bump tomajorif you disagree — the changeset summary calls this out explicitly.Screenshots (if appropriate)
Visual diffs will come through Chromatic (new
Inputstory + unchangedTextFieldstories).Testing approaches
TextField.spec.tsxpasses (3/3).tsc --skipLibCheck --moduleResolution bundler) clean; Biome clean.aria-labelso axe passes.Note
Medium Risk
Public API change on
Input(sizemeaning) and shared field CSS affect all inputs, groups, and picker buttons; medium default height should stay the same but typings and any nativesizeusage need a quick check.Overview
Adds a
sizeprop toInput(small/medium, default unchanged) so field height and typography align withButton(24px vs 32px). Shared field styling moves fromInput.module.csstofield.module.css, withsmallusing 11px text and token-based min-heights.sizeandvariantare stripped before rendering the DOM<input>(replacing the native numericsizeattribute on the public API viaOmit).GroupandTextAreano longer acceptsizeon their variant types.Buttonpicker+smallcomposesfieldStyles.smallfor consistent picker height;Groupnested inputs getmin-height: 0so groups size correctly.Storybook adds
Input.stories.tsxand aSelectsizes example.Reviewed by Cursor Bugbot for commit b5dbec3. Bugbot is set up for automated code reviews on this repo. Configure here.