Skip to content

Core: Fix input width#33591

Merged
ghengeveld merged 2 commits into
nextfrom
fix-input-width
Jan 19, 2026
Merged

Core: Fix input width#33591
ghengeveld merged 2 commits into
nextfrom
fix-input-width

Conversation

@ghengeveld
Copy link
Copy Markdown
Member

@ghengeveld ghengeveld commented Jan 19, 2026

What I did

Fixed a regression where inputs did not stretch to fill their container anymore.

Checklist for Contributors

Testing

The changes in this PR are covered in the following automated tests:

  • stories
  • unit tests
  • integration tests
  • end-to-end tests

Manual testing

Caution

This section is mandatory for all contributions. If you believe no manual test is necessary, please state so explicitly. Thanks!

Documentation

  • Add or update documentation reflecting your changes
  • If you are deprecating/removing a feature, make sure to update
    MIGRATION.MD

Checklist for Maintainers

  • When this PR is ready for testing, make sure to add ci:normal, ci:merged or ci:daily GH label to it to run a specific set of sandboxes. The particular set of sandboxes can be found in code/lib/cli-storybook/src/sandbox-templates.ts

  • Make sure this PR contains one of the labels below:

    Available labels
    • bug: Internal changes that fixes incorrect behavior.
    • maintenance: User-facing maintenance tasks.
    • dependencies: Upgrading (sometimes downgrading) dependencies.
    • build: Internal-facing build tooling & test updates. Will not show up in release changelog.
    • cleanup: Minor cleanup style change. Will not show up in release changelog.
    • documentation: Documentation only changes. Will not show up in release changelog.
    • feature request: Introducing a new feature.
    • BREAKING CHANGE: Changes that break compatibility in some way with current major version.
    • other: Changes that don't fit in the above categories.

🦋 Canary release

This PR does not have a canary release associated. You can request a canary release of this pull request by mentioning the @storybookjs/core team here.

core team members can create a canary release here or locally with gh workflow run --repo storybookjs/storybook publish.yml --field pr=<PR_NUMBER>

Summary by CodeRabbit

  • Style
    • Input component now extends to full container width
    • Fixed minor formatting inconsistency in style definitions

✏️ Tip: You can customize this high-level summary in your review settings.

@nx-cloud
Copy link
Copy Markdown

nx-cloud Bot commented Jan 19, 2026

View your CI Pipeline Execution ↗ for commit 7ee4fa6

Command Status Duration Result
nx run-many -t compile,check,knip,test,pretty-d... ✅ Succeeded 5m 46s View ↗

☁️ Nx Cloud last updated this comment at 2026-01-19 20:28:57 UTC

@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai Bot commented Jan 19, 2026

📝 Walkthrough

Walkthrough

CSS styling updates to the Form Input component. One change adds full-width styling to ensure the input element expands to 100% width. The other corrects a formatting issue in style reset declarations by removing a leading whitespace character.

Changes

Cohort / File(s) Change Summary
Form Component Styling
code/core/src/components/components/Form/Input.tsx, code/core/src/components/components/Form/styles.ts
Input element width set to 100%. Fixed CSS reset display property formatting by removing leading space from ' block' to 'block'.

Estimated code review effort

🎯 1 (Trivial) | ⏱️ ~3 minutes

✨ Finishing touches
  • 📝 Generate docstrings

Comment @coderabbitai help to get the list of available commands and usage tips.

Copy link
Copy Markdown
Contributor

@coderabbitai coderabbitai Bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 1

🤖 Fix all issues with AI agents
In `@code/core/src/components/components/Form/Input.tsx`:
- Around line 84-87: The width: '100%' being applied after the sizes object
overrides size-specific styles (e.g., size="flex" -> {flex:1}, size="auto" ->
{display:'inline'}) causing layout regressions; update the Input style merge in
Input.tsx where styles, sizes, alignment, validation, { minHeight:32,
width:'100%' } are composed so that width is conditional on the resolved size:
if size === 'flex' do not set width (let flex:1 handle sizing), if size ===
'auto' avoid forcing width, otherwise apply width:'100%'; ensure the conditional
uses the same size prop used by the sizes map (refer to sizes and InputProps) so
Text, Files, Number controls retain their intended behavior.

Comment on lines 84 to 87
)<InputProps>(styles, sizes, alignment, validation, {
minHeight: 32,
width: '100%',
}),
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.

⚠️ Potential issue | 🟠 Major

🧩 Analysis chain

🏁 Script executed:

cat -n code/core/src/components/components/Form/Input.tsx | head -100

Repository: storybookjs/storybook

Length of output: 2540


🏁 Script executed:

# Search for Input component usages with size prop
rg -n "size=\"|size={" code/core/src/components/components/Form/ -A 2 -B 2 --type tsx

Repository: storybookjs/storybook

Length of output: 154


🏁 Script executed:

# Find all files that import Input from Form/Input
rg -l "from.*Form/Input|from.*Form/Input" code/ --type tsx

Repository: storybookjs/storybook

Length of output: 92


🏁 Script executed:

# Search for size prop values being used in the codebase
rg "size=['\"]" code/ --type tsx -o | sort | uniq -c

Repository: storybookjs/storybook

Length of output: 92


🏁 Script executed:

cat -n code/core/src/components/components/Form/styles.ts | head -150

Repository: storybookjs/storybook

Length of output: 3610


🏁 Script executed:

# Search for Input component usages with size prop - corrected syntax
rg -n 'Input.*size=' code/ --type ts --type tsx -B 1 -A 1

Repository: storybookjs/storybook

Length of output: 92


🏁 Script executed:

# Also search for imports of Input component
rg -n 'import.*Input.*from.*Form/Input' code/ --type ts --type tsx

Repository: storybookjs/storybook

Length of output: 92


🏁 Script executed:

fd -t f -e ts -e tsx | xargs rg -l 'Input' | head -20

Repository: storybookjs/storybook

Length of output: 1234


🏁 Script executed:

# Search directly for usage patterns
rg '<Input' code/ -A 2 | head -50

Repository: storybookjs/storybook

Length of output: 3196


🏁 Script executed:

# Check if flex or auto size is used
rg "size=['\"]flex['\"]|size=['\"]auto['\"]" code/

Repository: storybookjs/storybook

Length of output: 265


🏁 Script executed:

cat -n code/addons/docs/src/blocks/controls/Text.tsx | head -80

Repository: storybookjs/storybook

Length of output: 2613


🏁 Script executed:

find code/core/src/components/components/Form -name "*.tsx" -type f | head -20

Repository: storybookjs/storybook

Length of output: 788


🏁 Script executed:

cat -n code/core/src/components/components/Form/Textarea.tsx | head -50

Repository: storybookjs/storybook

Length of output: 1698


🏁 Script executed:

cat -n code/core/src/components/components/Form/Textarea.tsx | tail -40

Repository: storybookjs/storybook

Length of output: 1336


Check size prop behavior—width: '100%' overrides size="flex" which is actively used.

width: '100%' is applied after sizes, which means:

  • size="flex" returns { flex: 1 }, then width: '100%' overrides it (breaks flex layouts in Text, Files, Number controls)
  • size="auto" returns { display: 'inline' }, then width: '100%' contradicts inline display

This is a functional regression affecting real uses in the codebase. Make width conditional on size to preserve the intended behavior:

Suggested fix
-  )<InputProps>(styles, sizes, alignment, validation, {
-    minHeight: 32,
-    width: '100%',
-  }),
+  )<InputProps>(styles, sizes, alignment, validation, ({ size }) => ({
+    minHeight: 32,
+    width: !size || size === '100%' ? '100%' : 'auto',
+  })),
🤖 Prompt for AI Agents
In `@code/core/src/components/components/Form/Input.tsx` around lines 84 - 87, The
width: '100%' being applied after the sizes object overrides size-specific
styles (e.g., size="flex" -> {flex:1}, size="auto" -> {display:'inline'})
causing layout regressions; update the Input style merge in Input.tsx where
styles, sizes, alignment, validation, { minHeight:32, width:'100%' } are
composed so that width is conditional on the resolved size: if size === 'flex'
do not set width (let flex:1 handle sizing), if size === 'auto' avoid forcing
width, otherwise apply width:'100%'; ensure the conditional uses the same size
prop used by the sizes map (refer to sizes and InputProps) so Text, Files,
Number controls retain their intended behavior.

@storybook-app-bot
Copy link
Copy Markdown

Package Benchmarks

Commit: 7ee4fa6, ran on 19 January 2026 at 20:30:32 UTC

The following packages have significant changes to their size or dependencies:

@storybook/nextjs

Before After Difference
Dependency count 538 538 0
Self size 646 KB 646 KB 🎉 -10 B 🎉
Dependency size 59.22 MB 59.28 MB 🚨 +58 KB 🚨
Bundle Size Analyzer Link Link

@storybook/nextjs-vite

Before After Difference
Dependency count 127 127 0
Self size 1.12 MB 1.12 MB 🎉 -22 B 🎉
Dependency size 21.82 MB 21.87 MB 🚨 +49 KB 🚨
Bundle Size Analyzer Link Link

@storybook/react-native-web-vite

Before After Difference
Dependency count 159 159 0
Self size 30 KB 30 KB 🚨 +8 B 🚨
Dependency size 23.00 MB 23.17 MB 🚨 +164 KB 🚨
Bundle Size Analyzer Link Link

@storybook/react-vite

Before After Difference
Dependency count 117 117 0
Self size 35 KB 35 KB 🎉 -8 B 🎉
Dependency size 19.62 MB 19.66 MB 🚨 +49 KB 🚨
Bundle Size Analyzer Link Link

@storybook/react-webpack5

Before After Difference
Dependency count 278 278 0
Self size 24 KB 24 KB 🚨 +2 B 🚨
Dependency size 44.13 MB 44.19 MB 🚨 +58 KB 🚨
Bundle Size Analyzer Link Link

@storybook/cli

Before After Difference
Dependency count 183 183 0
Self size 775 KB 775 KB 🚨 +139 B 🚨
Dependency size 67.38 MB 67.46 MB 🚨 +79 KB 🚨
Bundle Size Analyzer Link Link

@storybook/codemod

Before After Difference
Dependency count 176 176 0
Self size 30 KB 30 KB 🎉 -40 B 🎉
Dependency size 65.95 MB 66.03 MB 🚨 +79 KB 🚨
Bundle Size Analyzer Link Link

@storybook/react

Before After Difference
Dependency count 57 57 0
Self size 732 KB 781 KB 🚨 +49 KB 🚨
Dependency size 12.94 MB 12.94 MB 🚨 +409 B 🚨
Bundle Size Analyzer Link Link

@ghengeveld ghengeveld merged commit 2a4f3e4 into next Jan 19, 2026
123 checks passed
@ghengeveld ghengeveld deleted the fix-input-width branch January 19, 2026 20:43
@github-actions github-actions Bot mentioned this pull request Jan 19, 2026
18 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant