Textarea
Multi-line input for longer, free-form responses such as claim notes or supporting detail.
Purpose
Use a Textarea when the answer runs to a sentence or more. For short, single-line answers use
Input.
Example
States
Six states cover the lifecycle. Focus is shown with its styles applied for illustration.
Add a short note explaining the claim.
Rows
Textarea is a styled native <textarea>, so the native rows attribute sets the visible height.
The control never shrinks below its 80px minimum (min-h-20), so rows values under three have no
effect; larger values make room for longer answers up front. The native corner resize handle is
kept, so users can drag the field taller themselves.
Structure
The tokens behind the control — change these, and every textarea follows.
| Property | Value |
|---|---|
| Min height | 80px (min-h-20), grows with rows |
| Padding | 12px horizontal, 8px vertical (px-3 py-2) |
| Typography | 14px (text-sm); placeholder --muted-foreground |
| Border | 1px --input |
| Radius | --radius-md (6px) |
| Shadow | --shadow-1 |
| Focus | border --ring + 2px --ring at 40% |
| Error | border --destructive + ring at 30% (via aria-invalid) |
| Disabled | 50% opacity, --muted fill, not-allowed cursor |
Best practices
Do
- Keep the label visible — pair every Textarea with a
Labelor wrap it inField. - Size the field to the expected answer with
rows— a cramped box invites cramped answers. - Put length or format guidance in the hint, not the placeholder.
- Show a character count when a hard limit applies, and validate on blur or submit.
Don't
- Use a Textarea for short, single-line answers — that is Input's job.
- Rely on colour alone for errors — always pair the red border with a message.
- Disable paste — long-form answers are often drafted elsewhere.
- Trap Enter for form submission — inside a textarea, Enter must insert a newline.
Accessibility & keyboard
Field does the wiring; these are the guarantees the pattern gives you.
- Label and control are linked with
htmlFor; hint and error are announced viaaria-describedby. - Errors set
aria-invalid, which drives the destructive border and ring — colour is always paired with a written message. - Focus shows a 2px
--ringoutline — never remove it. - Keyboard: Tab / Shift+Tab move between fields; Enter inserts a newline rather than submitting; standard text editing inside.
Props
Textarea is a styled native <textarea> — it accepts every native attribute (rows, maxLength, autoComplete…) and adds nothing on top.
No public props found for TextareaProps.
Select
Pick exactly one option from a known list. Built on Radix Select: keyboard type-ahead, portalled listbox, announced value. For searchable or long lists use Combobox; for several choices use MultiSelect.
Label
The accessible name for a control. Every input needs one, wired by a matching id — a placeholder is not a label.