For the complete documentation index, see llms.txt. Markdown variants are available by appending .md to any URL or sending an Accept: text/markdown header. An agent skill is available at /.well-known/agent-skills/site-skill.md.
43
Sponsor

Field

Compose accessible form fields with labels, descriptions, and validation.

Payment Method

All transactions are secure and encrypted

Enter your 16-digit card number

Billing Address

The billing address associated with your payment method

import { Button } from "@/components/ui/button";
import { Checkbox } from "@/components/ui/checkbox";
import {
  Field,
  FieldDescription,
  FieldGroup,

Installation

$ pnpm dlx shadcn@latest add https://shadcn-cssinjs.com/r/field.json

Usage

import {
  Field,
  FieldContent,
  FieldDescription,
  FieldError,
  FieldGroup,
  FieldLabel,
  FieldLegend,
  FieldSeparator,
  FieldSet,
  FieldTitle,
} from "@/components/ui/field/field";
<Field>
  <FieldLabel htmlFor="email">Email</FieldLabel>
  <Input id="email" type="email" />
  <FieldDescription>We never share your email.</FieldDescription>
</Field>

Composition

FieldSet
├── FieldLegend
├── FieldDescription
└── FieldGroup
    └── Field
        ├── FieldLabel
        ├── (control)
        └── FieldDescription

Examples

Input

Choose a unique username for your account.

Must be at least 8 characters long.

import {
  Field,
  FieldDescription,
  FieldGroup,
  FieldLabel,
  FieldSet,

Textarea

Share your thoughts about our service.

import {
  Field,
  FieldDescription,
  FieldGroup,
  FieldLabel,
  FieldSet,

Select

Select your department or area of work.

import {
  Field,
  FieldDescription,
  FieldLabel,
} from "@/components/ui/field";
import {

Slider

Price Range

Set your budget range ($200 - 800).

"use client";

import { useState } from "react";

import {
  Field,

Fieldset

Address Information

We need your address to deliver your order.

import {
  Field,
  FieldDescription,
  FieldGroup,
  FieldLabel,
  FieldLegend,

Checkbox

Show these items on the desktop

Select the items you want to show on the desktop.

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

import { Checkbox } from "@/components/ui/checkbox";
import {
  Field,
  FieldContent,
  FieldDescription,
  FieldGroup,

Radio

Subscription Plan

Yearly and lifetime plans offer significant savings.

import {
  Field,
  FieldDescription,
  FieldLabel,
  FieldLegend,
  FieldSet,

Switch

import { Field, FieldLabel } from "@/components/ui/field";
import { Switch } from "@/components/ui/switch";

export function FieldSwitch() {
  return (
    <Field className="w-fit" orientation="horizontal">

Choice Card

Compute Environment

Select the compute environment for your cluster.

import {
  Field,
  FieldContent,
  FieldDescription,
  FieldGroup,
  FieldLabel,

Field Group

Get notified when ChatGPT responds to requests that take time, like research or image generation.

Get notified when tasks you've created have updates. Manage tasks

import { Checkbox } from "@/components/ui/checkbox";
import {
  Field,
  FieldDescription,
  FieldGroup,
  FieldLabel,

Responsive Layout

Use orientation="responsive" to stack the label and control on small screens and place them side by side on larger screens.

Profile

Fill in your profile information.

Provide your full name for identification

import { Button } from "@/components/ui/button";
import {
  Field,
  FieldContent,
  FieldDescription,
  FieldGroup,

RTL

To enable right-to-left support, see the RTL guide.

معلومات العنوان

نحتاج إلى عنوانك لتوصيل طلبك.

أدخل اسمك الكامل لتحديد الهوية.

"use client";

import { useTranslation } from "@/components/language-selector";
import type { Translations } from "@/components/language-selector";
import {
  Field,

API Reference

FieldSet

Container that renders a semantic fieldset with spacing presets.

PropTypeDefault
classNamestring-

FieldLegend

Legend element for a FieldSet. Switch to the label variant to align with label sizing.

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

FieldGroup

Layout wrapper that stacks Field components.

PropTypeDefault
classNamestring-

Field

The core wrapper for a single field. Provides orientation control and spacing.

PropTypeDefault
orientation"vertical" | "horizontal" | "responsive""vertical"
classNamestring-

FieldContent

Flex column that groups the control and descriptions when the label sits beside the control.

PropTypeDefault
classNamestring-

FieldLabel

Label styled for both direct inputs and nested Field children.

PropTypeDefault
classNamestring-

FieldTitle

Renders a title with label styling inside FieldContent.

PropTypeDefault
classNamestring-

FieldDescription

Helper text slot that automatically balances long lines in horizontal layouts.

PropTypeDefault
classNamestring-

FieldSeparator

A separator between fields, with optional content rendered in the middle.

PropTypeDefault
childrenReact.ReactNode-
classNamestring-

FieldError

Displays validation errors. Pass children or an errors array.

PropTypeDefault
errorsArray<{ message?: string } | undefined>-
childrenReact.ReactNode-