Forms
FormField
Bordered shell shared by text-like controls, with before/after slots, status and plain mode.
import { FormField } from "datui";Examples
Slots and states
Wrap any bare control. Clicking empty shell space focuses it.
Accessibility
- FormField is visual only. The control inside must carry its own label and
aria-invalid(FormItem and datui inputs do this). - Mouse down on empty shell space or a non-interactive slot moves focus to the first control inside.
API
FormField
Bordered shell shared by every text-like control (Input, Textarea, selects, chips and date inputs). Put the control as `children`; give it `flex-1 min-w-0`. Clicking empty shell space focuses the control. The shell itself carries no semantics: the control must expose `aria-invalid`, label and description.
| Prop | Type | Default | Description |
|---|---|---|---|
| after | ReactNode | — | Content after the control, e.g. an icon, clear button or unit. |
| afterAlign | FormFieldSlotAlign | center | Vertical alignment of `after`. |
| before | ReactNode | — | Content before the control, usually an icon. |
| beforeAlign | FormFieldSlotAlign | center | Vertical alignment of `before`. |
| className | string | — | |
| disabled | boolean | — | Dims the shell and sets `aria-disabled`. Disable the control itself as well. |
| maxHeight | number | — | Caps the field height in px; content scrolls beyond it. |
| mode | FormFieldMode | default | `plain` removes border and background, e.g. for fields inside cells or toolbars. |
| size | FormFieldSize | l | Minimum height, matching the control heights (`m` lines up with a default Button). |
| status | FormFieldStatus | default | Visual validation state. Pair `error` with `aria-invalid` on the control (FormItem does this). |