Skip to content

shadcn.io is not affiliated with official shadcn/ui

Shadcn Field for React

Container for inputs, labels, and helper text.

This is your public display name.

Installation

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

Usage

import {
  Field,
  FieldDescription,
  FieldLabel,
} from "@/components/ui/field";
import { Input } from "@/components/ui/input";
const FieldDemo = () => (
  <Field className="max-w-xs">
    <FieldLabel>Name</FieldLabel>
    <Input placeholder="Evil Rabbit" type="text" />
    <FieldDescription>This is your public display name.</FieldDescription>
  </Field>
);

Accessibility

KeyDescription
Space
Activate the focused control.
Enter
Activate the focused control.
ArrowUp
Move up.
ArrowDown
Move down.
ArrowLeft
Move left.
ArrowRight
Move right.
Home
Go to the start.
End
Go to the end.

Demos

Input

An input with the description above the control.

Textarea

A textarea with a label.

Select

A select with a label.

Slider

A slider with a label.

Fieldset

Two fields grouped under a legend.

Checkbox

A checkbox with its label.

Radio

Radio options inside a labeled field.

Switch

Horizontal switch field.

Choice Card

Choice cards: wrap Field in FieldLabel for selectable groups.

Group

Two fields divided by a separator.

Rtl

A right-to-left field. See the RTL configuration guide for document direction.

Responsive

A field whose orientation follows the container.

API Reference

Field

PropType
AttributeType

FieldSet

PropType
AttributeType

FieldLegend

PropType
AttributeType

FieldGroup

PropType
AttributeType

FieldContent

PropType
AttributeType

FieldLabel

PropType
AttributeType

FieldTitle

PropType
AttributeType

FieldDescription

PropType
AttributeType

FieldSeparator

PropType
AttributeType
data-content?string

FieldError

PropType
AttributeType