datui
Color scheme

Forms

Textarea

Multi-line native textarea that grows with its content.

import { Textarea } from "datui";

Playground

<Textarea placeholder="Message" rows={2} grow status="default" />

Examples

Auto-grow

Grows until maxHeight, then scrolls.

Accessibility

  • A native <textarea>; labelling and aria-invalid work as for Input.

API

Textarea

Multi-line native `<textarea>` in a FormField that grows with its content. Controlled (`value` + `onChange(event)`) or uncontrolled; `ref` points at the textarea.

PropTypeDefaultDescription
afterReactNode—Content after the control, e.g. an icon, clear button or unit.
afterAlignFormFieldSlotAlignendVertical alignment of `after`.
alignTextAlignleftText alignment.
beforeReactNode—Content before the control, usually an icon.
beforeAlignFormFieldSlotAlign"center"Vertical alignment of `before`.
classNamestring—
growbooleantrueGrow with the content (up to `maxHeight`, then scroll).
maxHeightnumber—Max height in px before the content scrolls.
modeFormFieldMode"default"`plain` removes border and background, e.g. for fields inside cells or toolbars.
onResize((element: HTMLTextAreaElement) => void)—Called after an auto-grow changed the textarea height.
slotProps{ root?: (FormFieldProps & { ref?: Ref<HTMLDivElement>; }); } | undefined—Props for the FormField shell. `className` and `style` also go to the shell.
statusFormFieldStatus"default"Visual validation state. Pair `error` with `aria-invalid` on the control (FormItem does this).