Components / Core
Textarea
Multi-line text field with a label, hint and error. autoResize grows it with its content, up to maxRows.
import { Textarea } from "@stylhero/ui";
Example
Code
import { Textarea } from "@stylhero/ui";
function TextareaExample() {
return <Textarea label="Notes" hint="Grows as you type, up to 6 lines." autoResize maxRows={6} />;
}
Props
| Prop | Type | Default | Description |
|---|---|---|---|
autoResize |
boolean |
- | Grow with the text instead of scrolling (MUI's TextareaAutosize). Cap it with maxRows. |
error |
ReactNode |
- | |
hint |
ReactNode |
- | Help text under the field. Replaced by error when set. |
label |
ReactNode |
- | |
maxRows |
number |
- |
Also takes every <textarea> attribute (id, style, data-*, aria-*, event handlers…), passed to that element. Takes a ref.
Accessibility
- The label, hint and error are linked to the control (
aria-describedby), anderrorsetsaria-invalid.
Generated from src/components/Textarea.tsx. Something wrong or missing? Open an issue.