Field
Combine labels, controls, and help text to compose accessible form fields and grouped inputs.
Installation
terminal
npx felicityui add field --platform reactUsage
example.tsx
import {
Field,
FieldDescription,
FieldError,
FieldGroup,
FieldLabel,
FieldLegend,
FieldSet,
} from "@/components/ui/field"
import { Input } from "@/components/ui/input"
<FieldSet>
<FieldLegend>Profile</FieldLegend>
<FieldDescription>This appears on invoices and emails.</FieldDescription>
<FieldGroup>
<Field>
<FieldLabel htmlFor="name">Full name</FieldLabel>
<Input id="name" placeholder="Evil Rabbit" />
</Field>
</FieldGroup>
</FieldSet>Composition
FieldSet
├── FieldLegend
├── FieldDescription
└── FieldGroup
├── Field
│ ├── FieldLabel
│ ├── Input
│ ├── FieldDescription
│ └── FieldError
└── FieldDefault
FieldSet with legend, group, input, error, and horizontal switch.
Input
We never share your email.
Textarea
One or two sentences.
Select
Slider
Applied to the preview layer.
Fieldset
Checkbox
Radio
Switch
Disables radios on this device.
Choice card
Wrap Field inside FieldLabel for selectable cards.
Field group
Or
Responsive
Shown on your public profile.
RTL
يظهر على الفواتير والرسائل.
API Reference
| Prop | Type | Default | Description |
|---|---|---|---|
| orientation | "vertical" | "horizontal" | "responsive" | — | Field layout orientation. |
| variant | "legend" | "label" | — | FieldLegend sizing variant. |
| errors | Array<{ message?: string } | undefined> | — | FieldError list from form libraries. |
| fieldVariants | ({ orientation?, className? }) => string | — | Exported class helper for Field. |
Accessibility
WCAG 2.2 AA
- FieldSet and FieldLegend group related controls.
- Field uses
role=group. - FieldError uses
role=alert. - Associate labels with controls via htmlFor.
Platform notes
React
Composition primitives with Felicity semantic tokens. FieldSet/FieldGroup/Field shells — not Base UI / Radix runtime.
- Client component (FieldError memoizes error lists).
- Uses
data-slot=field|field-set|field-group|field-label|field-description|field-error|field-content|field-legend|field-separator. - orientation vertical|horizontal|responsive;
data-invalidfor error styling. - Depends on label and separator registry items.