Textarea
For an answer longer than a line. Input's sibling; the same wiring, more room.
{/* Generated by scripts/build-component-docs.mjs — do not edit. The source is the component folder: guidance.json, the doc block and the props. Change those. */}
For an answer longer than a line. Input's sibling; the same wiring, more room.
Import
import { Textarea } from "@ir/ui";Variants
| Axis | Options | Default |
|---|---|---|
size | sm · md | md |
Do and don't
Set a minimum and let the field grow.
Don't — Fix the height and let content scroll inside it.
A box that cannot grow is why people write three words where they meant three sentences — they cannot see what they have written, so they stop. field-sizing-content does this without JavaScript.
Keep resize-y.
Don't — Leave the browser default resize, which drags both ways.
A textarea dragged wider breaks the column it sits in, and nobody has ever needed a wider one. Vertical is the axis people actually want.
Use Input.
Don't — Use a Textarea for a name, an ID or a threshold.
The size of the box is a promise about the length of the answer. A three-line box under "Probe name" invites a paragraph, and then something downstream has to truncate it.
State the limit, and show the count as it approaches.
Don't — Enforce maxLength silently.
A field that stops accepting characters without explanation reads as broken. If the limit matters enough to enforce, it matters enough to say.
Let read-only drop the resize handle along with the editing.
Don't — Leave a read-only textarea draggable.
A resize handle is an affordance for editing. On a field nobody can edit it is a control that does nothing, which is worse than no control.
Accessibility
- Wrap it in Field so the label, hint and error are wired — Textarea takes the same FieldControl as Input.
- aria-invalid rather than a prop, so the failure reaches assistive tech at the same moment the border turns red.
- field-sizing-content is Chrome-only today; elsewhere the minimum height plus the native resize handle is the fallback, which is what people already expect.
Where it is drawn
Figma — structure from figma, measurements from shadcn.