FormField
Label, description and error wiring for any control.
Staticimport { FormField } from 'umbra-ui'
Props
| Prop | Type | Default | Description |
|---|---|---|---|
children required | ReactNode | — | A single Umbra control (Input, Textarea, Select, Checkbox, RadioGroup, Switch). |
label required | ReactNode | — | Visible label, associated with the control. |
controlId | string | — | Id for the control. Generated when omitted. |
description | ReactNode | — | Helper text shown under the control and announced with it. |
disabled | boolean | false | Disables the control and dims the label. |
error | ReactNode | — | Error message. When set the field is invalid and the message is announced. |
required | boolean | false | Marks the control as required and shows an indicator next to the label. |
Usage notes
Wrap exactly one Umbra control. It receives its id, aria-describedby, aria-invalid, required and disabled through context; props set on the control win.
Accessibility
<label for>is wired to the control; group controls getaria-labelledby.- Description and error are both referenced by
aria-describedby, error first. - The error container is an
aria-live="polite"region, so new errors are announced. - The required asterisk is decorative; the control gets
required.
Import
import { FormField } from 'umbra-ui';
import 'umbra-ui/styles.css'; // once, at the root of your app