Overview
TextArea is a form input component that allows users to enter multi-line text. It supports validation, help messages, and multiple size variants.Basic Usage
With Validation
Sizes
TextArea comes in four sizes:small, medium (default), large, and extra-large.
Character Count
When
maxLength is set, a character counter is automatically displayed alongside the help message.Props
The name of the textarea field. Used for form submission and identification.
The label displayed above the textarea.
Placeholder text displayed when the field is empty.
The current value of the textarea.
The size of the textarea. Options:
'small' | 'medium' | 'large' | 'extra-large'The color theme for the field. Options:
'brand' | 'primary' | 'secondary' | 'success' | 'danger' | 'warning' | 'info'The number of visible text rows.
The visible width of the textarea in average character widths.
Whether the field is required. Displays a required indicator next to the label.
Whether the textarea is disabled.
Whether the textarea is read-only.
Error message to display when the field is invalid.
Helper text displayed below the textarea.
Maximum number of characters allowed. Shows character count when set.
HTML autocomplete attribute.
Whether the field should autofocus on mount.
Callback fired when the textarea value changes.
Callback fired when the textarea loses focus.
Callback fired when the textarea is clicked.
Additional CSS class name for the container.
TypeScript
Accessibility
- Uses semantic
<textarea>element - Properly associated
<label>element - Required fields are indicated with
aria-required - Error messages are announced to screen readers
- Keyboard accessible (Tab, Shift+Tab for navigation)