---
title: "Label"
description: "Names a control that is not in a Field, such as a checkbox or a switch row. It has the look of form labels and fades when its control is disabled."
url: https://gelatinui.com/components/label
markdown_url: https://gelatinui.com/components/label.md
access: free
install: "npx shadcn@latest add @gelatin-ui/label"
registry_item: https://gelatinui.com/r/label.json
version: "2026-11-08"
index: https://gelatinui.com/llms.txt
docs_index: https://gelatinui.com/docs/llms.txt
---

# Label

> Names a control that is not in a Field, such as a checkbox or a switch row. It has the look of form labels and fades when its control is disabled.

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

## When to use it

Best for: The name of a control outside a Field, such as a Checkbox or a Switch row.

- Link it to its control with `htmlFor` and the control `id`, or put the control inside it.
- Put a Checkbox or a Switch inside the label, first: the whole row then toggles the control.
- Use `size="sm"` for a small option in a dense card.

## When not to use it

- Inside a form, with help or an error, use the `FieldLabel` of [Field](https://gelatinui.com/components/field.md).

## Notes for agents

- Link it with `htmlFor` and the control `id`, or put the control inside it.
- It fades when its control is disabled.

## Anatomy

```text
Label
```

## API reference

### Label

| Prop | Type | Default | Description |
| --- | --- | --- | --- |
| `size` | `"default" \| "sm"` | "default" | `default`: the label look of the form components (14/20, weight 500, `foreground`). `sm`: the meta look (12/16, weight 400, `muted-foreground`) for a small option next to a Checkbox or Switch. |

## Styling

| Part | Slot | States | CSS variables | Tokens |
| --- | --- | --- | --- | --- |
| Label | `label` | `data-disabled` |  |  |

## Usage

Link the label to its control with `htmlFor` and the control `id`, or put the control inside it. Inside a `Field`, use `FieldLabel`.

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

```bash
npx shadcn@latest add @gelatin-ui/label @gelatin-ui/switch
```

```tsx title="weekly-digest-switch.tsx"
import { Label } from "@/components/ui/label";
import { Switch } from "@/components/ui/switch";

export function WeeklyDigestSwitch() {
  return (
    <div className="flex items-center gap-2">
      <Switch id="weekly-digest" name="weeklyDigest" defaultChecked />
      <Label htmlFor="weekly-digest">Send me a weekly digest</Label>
    </div>
  );
}
```

## Compose

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`.
- Compose the parts (`compose-parts`): Build each item from its named parts as children, and pass your text and icons in as parts.

## Add it

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

It adds 6 registry items: 3 files, 1150 lines, and the npm packages `clsx`, `tailwind-merge`, `tailwind-variants`.

## 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

- [Field](https://gelatinui.com/components/field.md)
- [Checkbox](https://gelatinui.com/components/checkbox.md)
- [Switch](https://gelatinui.com/components/switch.md)

## Accessibility

Label is a native `<label>`. With `htmlFor`, a click on the label focuses or toggles its control.

A Base UI Checkbox, Radio, or Switch puts its `id` on its hidden input. Base UI reads the label of that input and sets `aria-labelledby` on the control, so a screen reader reads the label as the name.

With the control inside the label, the full row is the hit area of the control.

When the control is disabled, the label text fades to 50% and the cursor shows not-allowed.
