Combine labels, controls, and help text to compose accessible form fields.
Loading...
import { Field, FieldDescription, FieldLabel } from "@/components/ui/field"
import { Input } from "@/components/ui/input"
Installation
pnpmnpmyarnbun
Usage
import {
Field,
FieldDescription,
FieldError,
FieldLabel,
} from "@/components/ui/field"<Field>
<FieldLabel htmlFor="username">Username</FieldLabel>
<Input id="username" />
<FieldDescription>Your public display name.</FieldDescription>
</Field>Examples
Horizontal Layout
Use orientation="horizontal" for inline layouts like checkboxes.
Loading...
import { Checkbox } from "@/components/ui/checkbox"
import {
Field,With Error
Add data-invalid="true" to Field and aria-invalid="true" to the input for error states.
Loading...
import {
Field,
FieldDescription,API Reference
Field
FieldLabel
A styled label that automatically associates with form controls.
FieldDescription
Helper text displayed below the input.
FieldError
Error message container with accessible alert role.
FieldContent
Wrapper for grouping label and description in horizontal layouts.