Textarea
Multiline text input. Pair with Label and field utilities for accessible forms.
Install
Import path
Examples
Disabled
Use the disabled prop to disable the textarea. To style the disabled state, add the data-disabled attribute to the Field component.
Field
Use Field, FieldLabel, and FieldDescription to create a textarea with a label and description.
Enter your message below.
Invalid
Use the aria-invalid prop to mark the textarea as invalid. To style the invalid state, add the data-invalid attribute to the Field component.
Please enter a valid message.
RTL
Right-to-left layout support for languages such as Arabic and Hebrew.
Translations are AI-generated for demonstration and may be imperfect.
شاركنا أفكارك حول خدمتنا.
Anatomy
How the parts compose. Copy this skeleton and fill in the slots.
import { Textarea } from "@codefast/ui/textarea";
<Textarea rows={3} placeholder="…" />
API reference
Props for each part of the component. All native element props are also forwarded.
Textarea
A multiline text input. Forwards all native textarea props.
| Prop | Type | Default | Description |
|---|---|---|---|
| rows | number | — | Initial visible height in lines. |
| maxLength | number | — | Hard cap on the number of characters. |
| value / onChange | string / (event) => void | — | Standard controlled textarea props. |
Accessibility
Built to be keyboard-navigable and screen-reader friendly out of the box.
- Always pair with a Label via htmlFor / id.
- If you show a counter, also enforce the limit with maxLength.
- Use aria-describedby to link helper or error text.
Guidelines
Conventions that keep usage consistent across an app.
Do
- Use for free-form, multi-line input like notes and bios.
- Show a counter when there’s a length limit.
Don’t
- Don’t use a textarea for single-line input — use Input.
- Don’t disable resize unless the layout truly requires it.