Forms
Input
Single-line native text input inside a FormField.
import { Input } from "datui";Playground
<Input placeholder="Your name" status="default" mode="default" align="left" />Examples
Controlled and uncontrolled
0 characters
€
Accessibility
- A native
<input>: all keyboard behavior is the browser's. status="error"setsaria-invalid; inside FormItem the label and description are linked automatically.- Without a FormItem, pass
aria-labelor your own<label htmlFor>.
API
Input
Single-line text input inside a FormField. A native `<input>`: works controlled (`value` + `onChange(event)`) or uncontrolled (`defaultValue`), and `ref` points at the input.
| 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`. |
| align | TextAlign | left | Text alignment inside the field. |
| before | ReactNode | — | Content before the control, usually an icon. |
| beforeAlign | FormFieldSlotAlign | "center" | Vertical alignment of `before`. |
| className | string | — | |
| 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). |
| slotProps | { root?: (FormFieldProps & { ref?: Ref<HTMLDivElement>; }); } | undefined | — | Props for the FormField shell. `className` and `style` also go to the shell. |
| status | FormFieldStatus | "default" | Visual validation state. Pair `error` with `aria-invalid` on the control (FormItem does this). |