- Accordion
- Alert
- Alert Dialog
- Aspect Ratio
- Avatar
- Badge
- Breadcrumb
- Button
- Button Group
- Calendar
- Card
- Carousel
- Chart
- Checkbox
- Collapsible
- Combobox
- Command
- Context Menu
- Data Table
- Date Picker
- Dialog
- Drawer
- Dropdown Menu
- Empty
- Field
- Hover Card
- Input
- Input Group
- Input OTP
- Item
- Kbd
- Label
- Menubar
- Native Select
- Navigation Menu
- Pagination
- Popover
- Progress
- Radio Group
- Resizable
- Scroll Area
- Select
- Separator
- Sheet
- Sidebar
- Skeleton
- Slider
- Sonner
- Spinner
- Switch
- Table
- Tabs
- Textarea
- Toast
- Toggle
- Toggle Group
- Tooltip
- Typography
Component field-demo not found in registry.
Installation
pnpm dlx createui@latest add field
Usage
import {
Field,
FieldContent,
FieldDescription,
FieldError,
FieldFooter,
FieldGroup,
FieldHelper,
FieldLabel,
FieldLegend,
FieldSeparator,
FieldSet,
FieldTitle,
} from "@/components/ui/field"<FieldSet>
<FieldLegend>Profile</FieldLegend>
<FieldDescription>This appears on invoices and emails.</FieldDescription>
<FieldGroup>
<Field>
<FieldLabel htmlFor="name">Full name</FieldLabel>
<Input id="name" autoComplete="off" placeholder="Evil Rabbit" />
<FieldDescription>This appears on invoices and emails.</FieldDescription>
</Field>
<Field invalid>
<FieldLabel htmlFor="username">Username</FieldLabel>
<Input id="username" autoComplete="off" aria-invalid />
<FieldError>Choose another username.</FieldError>
</Field>
<Field orientation="horizontal">
<Switch id="newsletter" />
<FieldLabel htmlFor="newsletter">Subscribe to the newsletter</FieldLabel>
</Field>
</FieldGroup>
</FieldSet>Anatomy
<Field size="md">
<FieldLabel htmlFor="input-id">Label</FieldLabel>
{/* Input, Select, Switch, etc. */}
<FieldDescription>Optional helper text.</FieldDescription>
<FieldHelper icon={<InfoIcon />}>Contextual helper with icon.</FieldHelper>
<FieldError>Validation message.</FieldError>
<FieldFooter>
<a href="#">Learn more →</a>
</FieldFooter>
</Field>Field— container. Providessize,orientation, andinvalid/disabledstate via context.FieldLabel— semantic<label>. Pairs withhtmlForand propagates label sizing.FieldContent— flex column to group label + description next to a control (horizontal layouts).FieldDescription— helper<p>in neutral tone. Flips to error tone when the field is invalid.FieldHelper— icon + text helper row. Acceptstone: "neutral" | "error".FieldError— accessible error container (role="alert"). Accepts children or anerrorsarray.FieldFooter— trailing CTA slot (inline link, arrow icon) that lives below the control.FieldGroup— stack of fields with@container/field-groupfor responsive orientation.FieldSet/FieldLegend— semantic grouping for related fields.FieldSeparator— visual divider, optional inline label.
Sizes
Field exposes size: "sm" | "md" | "lg" and propagates it via context to FieldLabel, FieldDescription, FieldHelper, FieldError, and FieldFooter. Override per-child by passing size directly.
Orientation
vertical(default) — stacks label, control, and helper text.horizontal— label and control side-by-side; pair withFieldContentto keep descriptions aligned.responsive— stacks on narrow containers, flips to horizontal at the@md/field-groupcontainer query breakpoint.
Component field-responsive not found in registry.
Validation and Errors
Set invalid on Field (or the legacy data-invalid attribute) to switch the block into an error state. Add aria-invalid on the control itself for assistive technologies.
<Field invalid>
<FieldLabel htmlFor="email">Email</FieldLabel>
<Input id="email" type="email" aria-invalid />
<FieldError>Enter a valid email address.</FieldError>
</Field>FieldError accepts an errors array from form libraries (React Hook Form, Standard Schema validators like Zod, Valibot, ArkType). Multiple messages render as a list automatically.
Disabled
Set disabled on Field (or the legacy data-disabled attribute) so descendants inherit disabled styling. The control itself still needs its own disabled prop for interaction.
Examples
Input
Component field-input not found in registry.
Textarea
Component field-textarea not found in registry.
Select
Component field-select not found in registry.
Checkbox
Component field-checkbox not found in registry.
Radio
Component field-radio not found in registry.
Switch
Component field-switch not found in registry.
Slider
Component field-slider not found in registry.
Fieldset
Component field-fieldset not found in registry.
Choice Card
Wrap Field components inside FieldLabel to create selectable field groups. Works with Radio, Checkbox, and Switch.
Component field-choice-card not found in registry.
Field Group
Stack Field components with FieldGroup. Add FieldSeparator to divide.
Component field-group not found in registry.
Accessibility
FieldSetandFieldLegendkeep related controls grouped for keyboard and assistive tech users.Fieldoutputsrole="group"so nested controls inherit labelling fromFieldLabelandFieldLegendwhen combined.FieldErrorusesrole="alert"so screen readers announce validation messages as they appear.
API Reference
Field
| Prop | Type | Default |
|---|---|---|
size | "sm" | "md" | "lg" | "md" |
orientation | "vertical" | "horizontal" | "responsive" | "vertical" |
invalid | boolean | |
disabled | boolean | |
className | string |
FieldLabel
Semantic <label> element (Radix Label.Root). Size is inherited from Field context; override with size prop.
| Prop | Type | Default |
|---|---|---|
size | "sm" | "md" | "lg" | context |
htmlFor | string | |
className | string |
FieldDescription
Helper text below the control (<p>). Picks up error tone automatically when the field is invalid.
FieldHelper
Icon + text helper row.
| Prop | Type | Default |
|---|---|---|
icon | ReactNode | |
tone | "neutral" | "error" | "error" when field invalid |
size | "sm" | "md" | "lg" | context |
FieldError
Accessible error container (role="alert").
| Prop | Type | Default |
|---|---|---|
errors | Array<{ message?: string } | undefined> | |
size | "sm" | "md" | "lg" | context |
FieldFooter
Trailing inline CTA slot (link, arrow icon). Renders in text-primary-base.
FieldGroup
Vertical stack with @container/field-group for responsive fields.
FieldSet
Semantic <fieldset> container.
FieldLegend
Semantic <legend>. Supports variant: "legend" | "label" (defaults to the section-heading legend).
FieldSeparator
Visual divider with optional inline content.