Textarea
A multi-line text field with its label, hint and error, as Input.
Examples
Playground
States
Every state side by side. Hover and focus are forced, so they can be reviewed without a pointer.
rest
hover
focus
error
This field is required.
disabled
Content
A hint, an error with its hint kept, and a long value that scrolls inside the field.
hint
Markdown is fine.
error, hint kept
This field is required.
Markdown is fine.long value
Install
npx shadcn add @hipuku/textareaUsage
import { Textarea } from '@/components/haus/components/Textarea'
<Textarea label="Notes" rows={4} value={notes} onChange={e => setNotes(e.target.value)} />API
Textarea also takes the textarea's own attributes and forwards its ref to it. className lands on
the root and controlClassName on the textarea.
| Prop | Type | Description |
|---|---|---|
label | string | |
hint | string | |
error | string | |
required | boolean | |
controlClassName | string | Lands on the field itself rather than the root, for the cases where the
control needs styling and the block around it does not. Ruling B5 put
className on the root of every component; this is the named second
target that rule asks for rather than redirecting the one everyone
expects. |
States
hint, error and required work as on Input. rows sets the starting height, and the user can
make it taller. A disabled Textarea cannot be resized.
Accessibility
- A native textarea with a real
label. Enter adds a line, and Tab moves on. - The hint and error are read as its description, and an error is announced when it appears.
requiredanderrorsetaria-requiredandaria-invalid.