Text Area Field
Text Area Field Component
The Text Area Field component provides a complete form field for multi-line text input with built-in label, validation, error handling, and character counting.
Example
Tell us what you think about our product
A short description about yourself
Please provide a description
Usage
import TextAreaField from "@altitude/ui/react/components/fields/text-area-field";
export default function FeedbackForm() { return ( <form> <TextAreaField id="feedback" name="feedback" label="Your Feedback" helperText="Tell us what you think about our product" placeholder="Type your feedback here..." required={true} maxlength={1000} />
{/* More form fields */} <button type="submit">Submit Feedback</button> </form> );}Props
| Prop | Type | Required | Description |
|---|---|---|---|
| id | string | No | HTML ID for the field |
| name | string | No | HTML name attribute for the field |
| label | string | No | Label text for the field |
| helperText | string | No | Helper text displayed below the field |
| errorMessage | string | No | Error message displayed when aria-invalid is true |
| placeholder | string | No | Placeholder text for the textarea |
| required | boolean | No | Whether the field is required (default: false) |
| aria-invalid | boolean | No | Whether the field has an error (default: false) |
| disabled | boolean | No | Whether the field is disabled (default: false) |
| maxlength | number | No | Maximum character count for the field |
| rows | number | No | Number of visible text lines |
| cols | number | No | Number of visible character columns |
Additional HTML textarea attributes can also be passed and will be forwarded to the underlying textarea element.
Implementation Details
The Text Area Field component combines an input wrapper and a textarea component:
- Uses
FieldWrapperto handle labels, error states, and helper text - Uses the base
TextAreaUI component for the actual textarea element - Automatically handles validation states and error messaging
- Includes character counting when maxlength is specified