datui
Color scheme

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.

PropTypeDefaultDescription
afterReactNode—Content after the control, e.g. an icon, clear button or unit.
afterAlignFormFieldSlotAligncenterVertical alignment of `after`.
beforeReactNode—Content before the control, usually an icon.
beforeAlignFormFieldSlotAligncenterVertical alignment of `before`.
classNamestring—
disabledboolean—Dims the shell and sets `aria-disabled`. Disable the control itself as well.
maxHeightnumber—Caps the field height in px; content scrolls beyond it.
modeFormFieldModedefault`plain` removes border and background, e.g. for fields inside cells or toolbars.
sizeFormFieldSizelMinimum height, matching the control heights (`m` lines up with a default Button).
statusFormFieldStatusdefaultVisual validation state. Pair `error` with `aria-invalid` on the control (FormItem does this).