Field
A component that provides labelling and validation for form controls.
Installation
pnpm dlx shadcn@latest add @lumi-ui/field
Anatomy
<Field>
<FieldLabel />
<FieldControl />
<FieldDescription />
<FieldItem />
<FieldError />
<FieldValidity />
</Field>Warning
Form controls must have an accessible name in order to be recognized by assistive technologies. <FieldLabel> and <FieldDescription> automatically assign the accessible name and description to their associated control.
State and Validation
Required
Error
Validity
Use with other form controls
Select
Autocomplete
Combobox
Note
You can implicitly label <Checkbox>, <Radio> and <Switch> components by enclosing them with <FieldLabel>. See example below.
Checkbox
Fieldset
Radio Group
Integration with Form
See Form Integration for more information.