Textarea
Multi-line text input with label, helper text, validation, auto-resize and a character count.
Installation
pnpm dlx nachui add textareaAnatomy
The label, description, error and count are wired to the textarea through
aria-describedby, so a screen reader announces them together. The id is generated when you do not pass one.Variants
Default
With label
label and description render above the field.Shown on the public status page while the incident is open.
With error
error marks the field invalid and shows the message below it.Request access
Tell the workspace owner why you need the production database.
Add at least 20 characters so the owner has context.
Auto resize
autoResize grows the textarea with its content. maxRows caps the height and the field scrolls past it.Grows with what you type, up to six lines.
With count
showCount renders the current length. With maxLength it renders 12 / 160.71 / 160
Compound Components
The parts are exposed for custom layouts:
API Reference
Textarea
| Prop | Type | Default | Description |
|---|---|---|---|
label | string | - | Label rendered above the textarea |
description | string | - | Helper text between the label and the field |
error | string | - | Error message, also sets aria-invalid |
size | "sm" | "default" | "lg" | "default" | Padding and font size |
resize | "none" | "vertical" | "both" | "vertical" | Which directions the user can drag |
autoResize | boolean | false | Grow with the content and disable manual resize |
maxRows | number | - | Maximum rows when autoResize is on |
showCount | boolean | false | Show the character count |
maxLength | number | - | Native limit, shown next to the count |
className | string | - | Additional CSS classes |
Every other attribute of a native
textarea is passed through.Textarea.Wrapper, Textarea.Label, Textarea.Description, Textarea.Error, Textarea.Count
Presentational parts. Each accepts
className and the attributes of the element it renders.Found something to improve?
Notice a bug, typo, or missing detail on this page? Help us make the documentation better by opening a GitHub issue.