Skip to content
shadcn.io
shadcn.io is not affiliated with official shadcn/ui

Shadcn Field for React and Tailwind

Container for inputs, labels, and helper text.

Choose a unique username for your account.

Installation

bunx --bun shadcn@latest add https://kit.dev/r/field.json

Anatomy

FieldSet
├── FieldLegend
└── FieldGroup
    ├── Field
    ├── FieldLabel
    │   └── FieldRequiredIndicator
    ├── FieldTitle
    ├── FieldDescription
    ├── FieldSeparator
    ├── FieldHelper
    └── FieldError

Usage

import { 
  Field, 
  FieldLabel, 
  FieldInput, 
  FieldHelper, 
  FieldError 
} from "@/components/ui/field";
<Field>
  <FieldLabel>Email</FieldLabel>
  <FieldInput />
  <FieldHelper>Enter your email address</FieldHelper>
  <FieldError>Email is required</FieldError>
</Field>

Examples

Input

Autocomplete

Combobox

Combobox Multiple

Textarea

Select

Checkbox

Checkbox Group

Radio Group

Switch

Slider

Use SliderLabel inside the Slider to label the slider.

Number Input

Field Group

API Reference

Field

Root layout for label, control, and helper/error text.

PropTypeDefault
orientation"vertical" | "horizontal" | "responsive""vertical"
reversebooleanfalse
invalidboolean-
disabledboolean-
requiredboolean-
readOnlyboolean-
asChildboolean-
classNamestring-

FieldSet

Groups related form controls semantically.

PropTypeDefault
classNamestring-

FieldLegend

Legend or label for a FieldSet group.

PropTypeDefault
variant"legend" | "label""legend"
classNamestring-

FieldGroup

Groups multiple fields with consistent spacing.

PropTypeDefault
classNamestring-

FieldContent

Wraps label, description, and error. Use with horizontal orientation.

PropTypeDefault
classNamestring-

FieldLabel

Label associated with the control.

PropTypeDefault
asChildboolean-
classNamestring-

FieldRequiredIndicator

PropTypeDefault
childrenReactNode"*"
classNamestring-
asChildboolean-

FieldTitle

Title wrapper for grouped field content.

PropTypeDefault
classNamestring-

FieldDescription

Helper text or description. Shown in muted foreground.

PropTypeDefault
classNamestring-

FieldSeparator

Horizontal divider between field groups. Optional center label.

PropTypeDefault
childrenReactNode-
classNamestring-

FieldHelper

Alias for FieldDescription. Use for consistency with other form libraries.

PropTypeDefault
classNamestring-

FieldError

Error message shown when the field is invalid. Shown in destructive color.

PropTypeDefault
classNamestring-

For a complete list of props, see the Ark UI documentation.