A bare multi-line text input — the native `<textarea>` is this component's own root element. It has no built-in label/hint/error; wrap it in `FormField` for that chrome. Works standalone too — not every textarea needs the full form suite.
A bare multi-line text input — the native <textarea> is this component's own root element. It has no built-in label/hint/error; wrap it in FormField for that chrome. Works standalone too — not every textarea needs the full form suite.
Usage
1import { Textarea } from '@behivetech/atoms.textarea';2import { FormField } from '@behivetech/forms.form-field';34const [value, setValue] = useState('');56<Textarea value={value} onChange={(e) => setValue(e.target.value)} />78<FormField label="Bio" htmlFor="bio" hint="Max 200 characters.">9 <Textarea id="bio" rows={3} />10</FormField>
Pass invalid (adds the --invalid modifier and sets aria-invalid) to visually mark the field as invalid (pair with FormField's error prop for the message).
Examples
Open all 4 →Basic Textarea
1const BasicTextarea = () => (2 <Textarea placeholder="Type your message..." />3);45render(<BasicTextarea />);
Textarea With Form Field
1const TextareaWithFormField = () => (2 <FormField label="Bio" htmlFor="bio" hint="Max 200 characters.">3 <Textarea id="bio" rows={3} />4 </FormField>5);67render(<TextareaWithFormField />);
Properties
Textarea props
| Prop | Type | Default | Description |
|---|---|---|---|
className | string | — | Additional class names to merge with the component root element |
invalid | boolean | false | Marks the field as invalid: adds the `--invalid` modifier and sets `aria-invalid="true"` |
Also accepts the native attributes of its root element (className, aria-*, event handlers, …).