# Checkbox Group

> Group of checkboxes that share a value array.

Registry name: `checkbox-group`. HTML docs: https://ui.anuragroy.dev/component/checkbox-group.

## Install

```bash
npx shadcn@latest add https://ui.anuragroy.dev/r/checkbox-group.json
```

If the website is down: `npx shadcn@latest add https://raw.githubusercontent.com/anurag-roy/ui.anuragroy.dev/main/public/r/checkbox-group.json`.

Registry JSON: https://ui.anuragroy.dev/r/checkbox-group.json (GitHub: https://raw.githubusercontent.com/anurag-roy/ui.anuragroy.dev/main/public/r/checkbox-group.json).

## Import

Import paths follow the consumer `components.json` aliases. After a default install:

```tsx
import { CheckboxGroup } from "@/components/ui/checkbox-group"
```

## Usage

```tsx
import { Checkbox } from "@/components/ui/checkbox"
import { CheckboxGroup } from "@/components/ui/checkbox-group"

export function Example() {
  return (
    <CheckboxGroup defaultValue={["a"]} className="flex flex-col gap-2">
      <label className="flex items-center gap-2 text-sm">
        <Checkbox value="a" /> Alpha
      </label>
      <label className="flex items-center gap-2 text-sm">
        <Checkbox value="b" /> Beta
      </label>
    </CheckboxGroup>
  )
}
```

## API

### CheckboxGroup

Base UI CheckboxGroup. Value is `string[]`.

| Prop | Type | Default | Description |
| --- | --- | --- | --- |
| `value` | string[] | — |  |
| `defaultValue` | string[] | — |  |
| `onValueChange` | (value: string[]) => void | — |  |

## See also

- [HTML page](https://ui.anuragroy.dev/component/checkbox-group): Preview and the same docs in the site chrome.
- [Registry item](https://ui.anuragroy.dev/r/checkbox-group.json): Source files and dependencies.
- [Catalog](https://ui.anuragroy.dev/component): All components.
- [llms.txt](https://ui.anuragroy.dev/llms.txt): Agent index for this library.
