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 />
</FieldRoot>State and Validation
Required
Error
Validity
Use with other form controls
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.
Select
Note
You can implicitly label <Checkbox>, <Radio> and <Switch> components by enclosing them with <FieldLabel>. See below Checkbox example.