Text Area
The Text Area component supports multi-line text input with theming, validation states, icons, labels, and accessibility features for richer large input handling.
Usage
Default
const [value, setValue] = useState("");
<TextArea
value={value}
onChange={(nextValue) => setValue(nextValue)}
placeholder="Enter your message..."
/>With Label
const [value, setValue] = useState("");
<TextArea
label="Message"
labelPosition="top"
value={value}
onChange={(nextValue) => setValue(nextValue)}
placeholder="Write your message..."
/>With Icon
const [value, setValue] = useState("");
<TextArea
icon={FaCommentDots}
value={value}
onChange={(nextValue) => setValue(nextValue)}
placeholder="Leave a comment..."
/>Validation States
<TextArea state="success" defaultValue="Looks good" />
<TextArea state="warning" defaultValue="Needs review" />
<TextArea state="error" defaultValue="Missing required details" />Fixed Height
const [value, setValue] = useState("");
<TextArea
height="160px"
value={value}
onChange={(nextValue) => setValue(nextValue)}
placeholder="A taller textarea for longer content..."
/>Non-Resizable
<TextArea
resizable={false}
defaultValue="This textarea cannot be resized."
/>With Accessible Description
Use this field to describe your experience with the product.
<TextArea
label="Experience"
ariaDescription="Use this field to describe your experience with the product."
placeholder="Describe your experience..."
/>Props
| Prop | Type | Default | Description |
|---|---|---|---|
| value | string | - | Controlled value of the textarea. |
| defaultValue | string | - | Initial value for uncontrolled usage. |
| placeholder | string | "Enter text" | Placeholder text shown when the textarea is empty. |
| label | string | - | Optional visible label displayed alongside the textarea. |
| labelPosition | "top" | "bottom" | "left" | "right" | "top" | Controls where the visible label is positioned. |
| theme | "primary" | "secondary" | "tertiary" | "quaternary" | "clear" | Configured Default | Visual theme applied to the textarea container. |
| state | "" | "success" | "error" | "warning" | "" | Validation or feedback state styling. |
| rounding | "none" | "small" | "medium" | "large" | Configured Default | Controls the border radius of the textarea container. |
| shadow | "none" | "light" | "medium" | "strong" | "intense" | Configured Default | Controls the shadow intensity of the container. |
| outline | boolean | false | Renders the textarea with an outlined style. |
| icon | React.ComponentType | - | Optional icon displayed inside the textarea container. |
| disabled | boolean | false | Disables the textarea and prevents interaction. |
| readOnly | boolean | false | Makes the textarea read-only while still focusable. |
| required | boolean | false | Marks the textarea as required. |
| height | string | number | - | Sets an explicit height for the textarea, such as `150px` or `220`. |
| resizable | boolean | true | If false, disables textarea resizing. |
| autocomplete | boolean | false | Enables native browser autocomplete when set to `true`. |
| ariaLabel | string | - | Accessible label used when no visible label is provided. Falls back to placeholder if needed. |
| ariaDescription | string | - | Additional description announced by screen readers via `aria-describedby`. |
| onChange | (value: string, event: React.ChangeEvent<HTMLTextAreaElement>) => void | - | Called when the textarea value changes. Receives both the current value and the original change event. |
| className | string | - | Additional custom class names for the textarea container. |
| data-testid | string | "text-area" | Test ID for the root element. |