[textarea] Implement Textarea component with auto-resize - #4630
Open
sernstberger wants to merge 1 commit into
Open
[textarea] Implement Textarea component with auto-resize#4630sernstberger wants to merge 1 commit into
sernstberger wants to merge 1 commit into
Conversation
sernstberger
requested review from
LukasTy,
atomiks,
colmtuite,
flaviendelangle and
michaldudak
as code owners
April 16, 2026 18:28
commit: |
Bundle size
PerformanceTotal duration: 1,533.36 ms 🔺+280.45 ms(+22.4%) | Renders: 53 (+0) | Paint: 2,366.10 ms 🔺+411.70 ms(+21.1%)
...and 7 more. View full report Check out the code infra dashboard for more information about this PR. |
✅ Deploy Preview for base-ui ready!Built without sensitive environment variables
To edit notification comments on pull requests, go to your Netlify project configuration. |
Member
|
@sernstberger Appreciate the effort, we decided to not provide this component: #718 (comment) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Implements the Textarea component requested in #718.
Parts
Textarea.Root— renders a<textarea>with auto-resize support. Integrates with Field for validation, labeling, and state management (dirty, touched, focused, filled).Textarea.CharacterCount— standalone<span>that displays character count withdata-approachingstate (>80% of max).Auto-resize
Uses CSS
field-sizing: contentwhere supported (Chrome 123+, Safari 17.4+, Edge 123+), with a JS measurement fallback for Firefox and older browsers. The fallback resets height to 0, readsscrollHeight, and sets height — all inside a layout effect to avoid flicker.Supports
minRowsandmaxRowsconstraints. When content exceedsmaxRows, the textarea becomes scrollable.Usage
Props
Textarea.Root:
autoResize(defaulttrue) — enable/disable auto-resizeminRows(default1) — minimum visible rowsmaxRows— maximum rows before scrollingmaxLength— native maxlength attributevalue/defaultValue/onValueChange— controlled/uncontrolledTextarea.CharacterCount:
value— current textarea valuemaxLength— max character countchildren— optional render function({ count, maxLength }) => ReactNodedata-approaching— set when count exceeds 80% of maxWhat's not included (intentionally)
contenteditablesupport (incompatible with constraint validation API, per discussion in [textarea] Add a Textarea component #718)Test plan
Closes #718