---
title: "Checkbox Group"
description: "A set of checkboxes with one shared value: the list of checked options. One size fits every box, and an optional parent box sets them all."
url: https://gelatinui.com/components/checkbox-group
markdown_url: https://gelatinui.com/components/checkbox-group.md
access: free
install: "npx shadcn@latest add @gelatin-ui/checkbox-group"
registry_item: https://gelatinui.com/r/checkbox-group.json
version: "2026-11-11"
index: https://gelatinui.com/llms.txt
docs_index: https://gelatinui.com/docs/llms.txt
---

# Checkbox Group

> A set of checkboxes with one shared value: the list of checked options. One size fits every box, and an optional parent box sets them all.

Page: https://gelatinui.com/components/checkbox-group

## When to use it

Best for: Any number of choices from 2 to 8 options that a person must see at once.

- Use it when the value is the list of checked options, not one yes or no.
- Give the group `allValues` and one Checkbox `parent` for a box that sets them all.
- Use `size="lg"` on the group, and every box in it takes that size.

## When not to use it

- For one choice from a short list, use a [Radio Group](https://gelatinui.com/components/radio-group.md).
- For many options, or options people search, use a [Combobox](https://gelatinui.com/components/combobox.md).

## Notes for agents

- The value is an array of the `value` of each checked Checkbox.
- Render it through a `FieldSet` for a legend: `<FieldSet render={<CheckboxGroup />}>`.
- A Checkbox prop wins over the group `size`.
- All Base UI props pass through.

## Anatomy

```text
CheckboxGroup
```

## API reference

### CheckboxGroup

| Prop | Type | Default | Description |
| --- | --- | --- | --- |
| `className` | `string` |  |  |
| `size` | `"default" \| "lg"` |  | The size of every checkbox in the group; a checkbox prop wins. |

Also takes every prop of Base UI `CheckboxGroup`: https://base-ui.com/react/components/checkbox-group

## Styling

| Part | Slot | States | CSS variables | Tokens |
| --- | --- | --- | --- | --- |
| CheckboxGroup | `checkbox-group` |  |  |  |

## Usage

Put each option in a label.

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

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

```tsx title="notify-channels.tsx"
import { Checkbox } from "@/components/ui/checkbox";
import { CheckboxGroup } from "@/components/ui/checkbox-group";
import { Field, FieldItem, FieldLabel, FieldLegend, FieldSet } from "@/components/ui/field";

export function NotifyChannels() {
  return (
    <Field>
      <FieldSet render={<CheckboxGroup defaultValue={["email"]} />}>
        <FieldLegend>Notify me by</FieldLegend>
        <FieldItem>
          <FieldLabel className="font-normal">
            <Checkbox value="email" />
            Email
          </FieldLabel>
        </FieldItem>
        <FieldItem>
          <FieldLabel className="font-normal">
            <Checkbox value="push" />
            Push
          </FieldLabel>
        </FieldItem>
      </FieldSet>
    </Field>
  );
}
```

## Compose

Rules:

- Compose the parts (`compose-parts`): Build each item from its named parts as children, and pass your text and icons in as parts.
- Every state is designed (`every-state`): Give each view of data its loading, empty, and error states: a skeleton in the final layout, an `Empty` with an illustration and one next action, and an error that says what failed and how to retry.

## Add it

```bash
npx shadcn@latest add @gelatin-ui/checkbox-group
```

It adds 8 registry items: 5 files, 1369 lines, and the npm packages `@base-ui/react`, `@phosphor-icons/react`, `clsx`, `tailwind-merge`, `tailwind-variants`.

## Built on

- [Checkbox](https://gelatinui.com/components/checkbox.md)

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

- [Checkbox](https://gelatinui.com/components/checkbox.md)
- [Radio Group](https://gelatinui.com/components/radio-group.md)
- [Field](https://gelatinui.com/components/field.md)

## Keyboard

| Keys | Action |
| --- | --- |
| Tab | Moves to the next box in the group. |
| Space | Checks or clears the focused box. |

## Accessibility

The group needs a name: a `FieldLegend` or an `aria-labelledby`.

A parent box shows a dash when only some boxes are checked.
