---
title: "Field"
description: "Puts a label, a control, and one line of help or an error together. FieldSet groups several controls under one legend."
url: https://gelatinui.com/components/field
markdown_url: https://gelatinui.com/components/field.md
access: free
install: "npx shadcn@latest add @gelatin-ui/field"
registry_item: https://gelatinui.com/r/field.json
version: "2026-11-08"
index: https://gelatinui.com/llms.txt
docs_index: https://gelatinui.com/docs/llms.txt
---

# Field

> Puts a label, a control, and one line of help or an error together. FieldSet groups several controls under one legend.

Page: https://gelatinui.com/components/field

## When to use it

Best for: One form control with its label, one line of help, and its error.

- Put every form control in a Field: it links the label, the control, the help, and the error for screen readers.
- Write an error that names the fix, such as "Add a domain (.com)." While it shows, the help hides, so the form keeps its height.
- Use `FieldError` with `match` (such as `valueMissing`) to show it for one check, or `match={true}` with the `invalid` prop of Field for an error you control.
- Use `FieldSet` and `FieldLegend` for related fields or a group of options.

## When not to use it

- To name a control outside a form, with no help or error, use a [Label](https://gelatinui.com/components/label.md).

## Notes for agents

- Field links the label, the control, the help, and the error by itself: do not set `id` or `aria-describedby` by hand.
- Show an error for one check with `FieldError match="valueMissing"`, or for your own check with `match={true}` and `invalid` on Field.

## Anatomy

```text
Field
├─ FieldLabel (0..n)
├─ FieldDescription (0..n)
├─ FieldError (0..n)
├─ FieldItem (0..n)
├─ FieldSet (0..n)
├─ FieldLegend (0..n)
├─ FieldGroup (0..n)
├─ FieldContent (0..n)
├─ FieldTitle (0..n)
├─ FieldSeparator (0..n)
└─ FieldValidity (0..n)
```

## API reference

### Field

| Prop | Type | Default | Description |
| --- | --- | --- | --- |
| `className` | `string` |  |  |

Also takes every prop of Base UI `Field.Root`: https://base-ui.com/react/components/field

### FieldLabel

| Prop | Type | Default | Description |
| --- | --- | --- | --- |
| `className` | `string` |  |  |
| `size` | `"default" \| "sm"` | "default" | `default` (14/20, weight 500) or `sm`, the meta look (12/16, weight 400, muted), as `Label`. |

Also takes every prop of Base UI `Field.Label`: https://base-ui.com/react/components/field

### FieldDescription

| Prop | Type | Default | Description |
| --- | --- | --- | --- |
| `className` | `string` |  |  |

### FieldError

| Prop | Type | Default | Description |
| --- | --- | --- | --- |
| `className` | `string` |  |  |

Also takes every prop of Base UI `Field.Error`: https://base-ui.com/react/components/field

### FieldItem

| Prop | Type | Default | Description |
| --- | --- | --- | --- |
| `className` | `string` |  |  |

Also takes every prop of Base UI `Field.Item`: https://base-ui.com/react/components/field

### FieldSet

| Prop | Type | Default | Description |
| --- | --- | --- | --- |
| `className` | `string` |  |  |

### FieldLegend

| Prop | Type | Default | Description |
| --- | --- | --- | --- |
| `className` | `string` |  |  |

### FieldGroup

No props of its own: `className`, `children`, and every other prop go to the element it renders.

### FieldContent

No props of its own: `className`, `children`, and every other prop go to the element it renders.

### FieldTitle

No props of its own: `className`, `children`, and every other prop go to the element it renders.

### FieldSeparator

| Prop | Type | Default | Description |
| --- | --- | --- | --- |
| `className` | `string` |  |  |

### FieldValidity

Also takes every prop of Base UI `Field.Validity`: https://base-ui.com/react/components/field

## Styling

| Part | Slot | States | CSS variables | Tokens |
| --- | --- | --- | --- | --- |
| Field | `field` | `data-size` | `--field-choice-indent`, `--motion-ease-out`, `--motion-ease-panel`, `--motion-fade`, `--motion-panel`, `--spacing` | `motion-timing` |
| FieldLabel | `field-label` | `data-disabled` |  |  |
| FieldDescription | `field-description` |  | `--field-choice-indent` |  |
| FieldError | `field-error` |  | `--field-choice-indent` |  |
| FieldItem | `field-item` | `data-size` | `--field-choice-indent`, `--spacing` |  |
| FieldSet | `field-set` |  |  |  |
| FieldLegend | `field-legend` | `data-disabled` |  |  |
| FieldGroup | `field-group` |  |  |  |
| FieldContent | `field-content` |  |  |  |
| FieldTitle | `field-title` | `data-disabled` |  |  |
| FieldSeparator | `field-separator` |  |  |  |
| FieldValidity | `field-validity` |  |  |  |

## Usage

Put the label, the control, the help, and the error in one `Field`, so they link for screen readers. With `match`, each `FieldError` shows for one check only.

The sample also uses `input`, which this add does not write. One command adds them with this item:

```bash
npx shadcn@latest add @gelatin-ui/field @gelatin-ui/input
```

```tsx title="billing-email-field.tsx"
import { Field, FieldDescription, FieldError, FieldLabel } from "@/components/ui/field";
import { Input } from "@/components/ui/input";

export function BillingEmailField() {
  return (
    <Field name="billingEmail" validationMode="onBlur">
      <FieldLabel>Billing email</FieldLabel>
      <Input type="email" required autoComplete="email" placeholder="finance@northwind.dev" />
      <FieldDescription>We send the invoice here.</FieldDescription>
      <FieldError match="valueMissing">Enter your billing email.</FieldError>
      <FieldError match="typeMismatch">Add an @ and a domain, like @northwind.dev.</FieldError>
    </Field>
  );
}
```

## Compose

Build it with:

- [Sidebar](https://gelatinui.com/components/sidebar.md): Moves between the settings sections.
- [Frame](https://gelatinui.com/components/frame.md): Groups the fields of one section, with Save in its footer.
- [Switch](https://gelatinui.com/components/switch.md): Turns one setting on or off at once.
- [Select](https://gelatinui.com/components/select.md): Picks one value from a short list.
- [Button](https://gelatinui.com/components/button.md): Saves the section or opens a dialog.
- [Toast](https://gelatinui.com/components/toast.md): Confirms the save.
- [Form](https://gelatinui.com/components/form.md): Owns the submit and the errors.
- [Input](https://gelatinui.com/components/input.md): Takes short text.

Rules:

- Touch targets (`touch-targets`): Give every control a hit area of at least 44 px on touch screens, even when it looks smaller.
- Group with a Frame (`group-in-frames`): Put related panels in one `Frame` with its header and footer outside the panels, and keep a plain `Card` for one block of content.
- Name every control (`label-every-control`): Give every field a visible `Label` (or a `Field`), and every icon button a `Tooltip` or an `aria-label`.
- Labels real apps use (`real-labels`): Write the button and menu labels that real apps use ("Create API key", "Invite members"), with no "…" at the end.

Patterns: `gelatin://patterns/settings-page`, `gelatin://patterns/form-flow`

## Add it

```bash
npx shadcn@latest add @gelatin-ui/field
```

It adds 11 registry items: 8 files, 1877 lines, and the npm packages `@base-ui/react`, `@mantine/hooks`, `@xstate/react`, `clsx`, `tailwind-merge`, `tailwind-variants`, `xstate`.

## For AI agents

- Every item, one file: https://gelatinui.com/llms.txt
- MCP server (`search_items`, `get_item`, `get_install_plan`): https://gelatinui.com/mcp

## Related

- [Form](https://gelatinui.com/components/form.md)
- [Input](https://gelatinui.com/components/input.md)
- [Label](https://gelatinui.com/components/label.md)

## Accessibility

Field is a Base UI `Field.Root`. `FieldLabel` renders a `<label>` for the control, and the control gets `aria-describedby` for `FieldDescription` and `FieldError`. A screen reader reads the name, then the help or the error.

While a `FieldError` shows, `FieldDescription` hides and renders no text. A screen reader reads the error alone, as the screen shows it.

Put "Optional" in `FieldLabel` as a muted span, so a screen reader reads it with the name. Wrap a Checkbox, Radio, or Switch in `FieldLabel` to make the full row the hit area. For a Select, use `SelectLabel` in place of `FieldLabel`: the trigger is a button, and a native `<label>` would pass its clicks to it.

`FieldSet` holds a group of fields or options, and `FieldLegend` names the group. In a disabled Field the label fades to 50%.

## Motion

| Part | Motion |
| --- | --- |
| Error shows and hides | none · the error and the help text swap in one frame, so the field never changes height |
