Field

Wrapper for form controls. Vertical, horizontal, or responsive orientation, with companion components (FieldLabel, FieldDescription, FieldError, FieldGroup, FieldSet) for every layout need.

Basic

Standard layout: FieldLabel above, control in the middle, FieldDescription below.

Dark previewReplay previewOpen in new tab

We use this to send important account updates.

Usage

Import the parts you need from the component's folder.

ts
import {
  Field,
  FieldLabel,
  FieldDescription,
  FieldError,
  FieldGroup,
  FieldSet,
  FieldLegend,
  FieldSeparator,
  FieldContent,
  FieldTitle,
} from "@/components/ui/field";

Textarea

Pair a multi-line Textarea with a label and helper text.

Dark previewReplay previewOpen in new tab

Share your thoughts about our service.

Select

Compose a Select control inside a Field, with a description below the trigger.

Dark previewReplay previewOpen in new tab

Select your department or area of work.

Slider

Use FieldTitle and FieldDescription to caption a range Slider that reflects the live value.

Dark previewReplay previewOpen in new tab
Price range

Set your budget range ($200 – $800).

FieldSet and FieldGroup

Wrap related fields together. FieldLegend gives the section a heading; FieldGroup is a vertical container between fields.

Dark previewReplay previewOpen in new tab
Personal information

Match the spelling on your government ID.

Checkbox

Group horizontal checkbox fields under a FieldLegend, with FieldContent for options that need a description.

Dark previewReplay previewOpen in new tab
Show these items on the desktop

Select the items you want to show on the desktop.

Your Desktop & Documents folders are being synced with cloud storage. You can access them from other devices.

Radio

A RadioGroup of horizontal fields inside a FieldSet.

Dark previewReplay previewOpen in new tab

Yearly and lifetime plans offer significant savings.

Switch

Horizontal field with FieldContent placing the label and description beside a Switch.

Dark previewReplay previewOpen in new tab

Enable multi-factor authentication. If you do not have a two-factor device, you can use a one-time code sent to your email.

Choice card

Wrap a Field inside FieldLabel to turn each option into a selectable card. The checked card is highlighted automatically.

Dark previewReplay previewOpen in new tab

Select the compute environment for your cluster.

Horizontal orientation

Label and control on one row. Suits short forms and setting toggles.

Dark previewReplay previewOpen in new tab

Responsive orientation

orientation="responsive" stacks on narrow screens and switches to a row once the FieldGroup container hits its md breakpoint.

Dark previewReplay previewOpen in new tab
Profile

Fill in your profile information.

Provide your full name for identification.

You can write your message here. Keep it short, preferably under 100 characters.

Validation and errors

Set data-invalid on Field, aria-invalid on the control, then use FieldError for the message.

Dark previewReplay previewOpen in new tab

API Reference

Field

PropTypeDefaultDescription
orientation"vertical" | "horizontal" | "responsive""vertical"Layout direction. Responsive stacks on small screens and switches to a row at the container's md breakpoint.
data-invalidboolean—HTML attribute. Set true to apply destructive colors to the label and children.
classstring—Additional classes for the wrapper.

FieldSet

PropTypeDefaultDescription
classstring—Renders a semantic fieldset that groups related fields with spacing presets.

FieldLegend

PropTypeDefaultDescription
variant"legend" | "label""legend"The label variant applies label sizing and alignment. Useful for nested FieldSets.
classstring—Additional classes for the legend heading.

FieldGroup

PropTypeDefaultDescription
classstring—Stacks Field components and opens a @container/field-group query so responsive fields can switch orientation.

FieldLabel

PropTypeDefaultDescription
forstring—Same as the native HTML for attribute; must match the control id. Wrap a Field inside FieldLabel to build a choice card.
classstring—Additional classes for the label.

FieldContent

PropTypeDefaultDescription
classstring—Flex column that groups label and description when the label sits beside the control. Optional when there is no description.

FieldTitle

PropTypeDefaultDescription
classstring—Heading with label styling for grouped controls that have no associated input id.

FieldDescription

PropTypeDefaultDescription
classstring—Helper text that automatically balances long lines in horizontal layouts.

FieldSeparator

PropTypeDefaultDescription
classstring—Visual divider between sections in a FieldGroup. Accepts optional inline content via the default slot.

FieldError

PropTypeDefaultDescription
errorsArray<string | { message?: string }>—Renders one or more validation messages as a list. Also accepts children via the default slot.
classstring—Additional classes for the error list.