Make your AI a shadcn expert

Shadcn Field

React field for labeled controls on checkout and settings forms. Built with TypeScript and Tailwind CSS for Next.js using Base UI — orientation, fieldsets, and errors.

A field is one control plus its label, helper text, and error. Use it for checkout, settings, and any form where those four parts should share spacing and invalid styles. FieldSet groups related questions; FieldGroup is just the gap.

Scroll to load preview...

Looking for a neobrutalism version for shadcn?

Same field, thicker borders. The NeoBrutalism field is the kit if you want that look.

Usage

import {
  Field,
  FieldDescription,
  FieldGroup,
  FieldLabel,
  FieldLegend,
  FieldSet,
} 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" placeholder="Evil Rabbit" />
    </Field>
    <Field orientation="horizontal">
      <Switch id="newsletter" />
      <FieldLabel htmlFor="newsletter">Subscribe to the newsletter</FieldLabel>
    </Field>
  </FieldGroup>
</FieldSet>

orientation is vertical by default. horizontal for a switch or checkbox. responsive follows the FieldGroup container, not the viewport.

Composition

FieldLegend
FieldDescription
FieldLabel
FieldContent
FieldTitle
FieldDescription
FieldError
FieldSeparator

FieldSeparator is a rule between groups. FieldTitle is the label look when there is no control to wire.

Input

Label, input, description. The description can sit above or below the control.

Scroll to load preview...

Textarea

Same stack for long text. rows stays on the textarea.

Scroll to load preview...

Select

FieldLabel names the trigger. Description sits under the dropdown.

Scroll to load preview...

Slider

FieldTitle when there is no input to wire. Put the live value in the description.

Scroll to load preview...

Fieldset

FieldSet plus FieldLegend is a real <fieldset>. Use it for an address block.

Scroll to load preview...

Checkbox

Horizontal Field, box first, then the label. FieldContent if you need a description.

Scroll to load preview...

Radio

One FieldSet, one RadioGroup, a horizontal Field per option.

Scroll to load preview...

Switch

Horizontal Field, label then thumb. w-fit so the row does not stretch.

Scroll to load preview...

Choice Card

Wrap Field in FieldLabel. The card highlights when the radio or checkbox inside is checked.

Scroll to load preview...

Field Group

FieldGroup stacks fields. FieldSeparator draws a rule between sections.

Scroll to load preview...

RTL

Wrap with DirectionProvider and dir="rtl". Copy is Arabic; the checkbox stays on the start edge.

Scroll to load preview...

Responsive Layout

orientation="responsive" is a column until the FieldGroup is @md wide.

Scroll to load preview...

API

Prop

Type

FieldLegend

Prop

Type

FieldError

Prop

Type

FieldLabel

Prop

Type

FieldSet is a <fieldset>. FieldGroup is the @container/field-group root. FieldContent, FieldTitle, FieldDescription, and FieldSeparator take className.

Notes

Invalid is two attributes

data-invalid on Field tints the label. aria-invalid on the input tints the border and tells the screen reader. You need both.

FieldError returns nothing when errors is empty — pass the array through.

With other components

Questions

Was this page helpful?

Sign in to leave feedback.