---
title: Checkbox Group
description: Provides shared state management for a series of checkboxes.
links:
doc: https://base-ui.com/react/components/checkbox-group#api-reference
---
## Preview
## Installation
CLI
Manual
```bash
npx @olyx/cli@latest add checkbox-group
```
Install the following dependencies:
```bash
npm install @base-ui/react
```
Copy and paste the following code into your project.
Update the import paths to match your project setup.
## Usage
```tsx
import { CheckBox } from "@/components/ui/checkbox"
import { CheckboxGroup } from "@/components/ui/checkbox-group"
import { Field, FieldLabel } from "@/components/ui/field"
```
```tsx
Next.js
Vite
Astro
```
## API Reference
### CheckboxGroup
Styled wrapper for `CheckboxGroup.Root` from Base UI. Provides shared state management for a group of checkboxes.
| Prop | Type | Default |
| ----------------- | --------------------- | ----------- |
| `value` | `string[]` | `undefined` |
| `defaultValue` | `string[]` | `undefined` |
| `onValueChange` | `(value: string[]) => void` | `undefined` |
| `disabled` | `boolean` | `false` |
| `allValues` | `string[]` | `undefined` |
| `preserveChildStates` | `boolean` | `false` |
**Parent Checkbox:** To use a parent checkbox that controls all children, add the `allValues` prop to `CheckboxGroup` with an array of all child values, and add the `parent` prop to the parent `CheckBox`.
For complete props documentation, see [Base UI CheckboxGroup](https://base-ui.com/react/components/checkbox-group#api-reference).
## Examples
For accessible group labelling and validation, prefer wrapping checkbox groups with `Field` and `Fieldset`. See the related example: [Checkbox group field](/ui/docs/components/field#checkbox-group-field).
### With Disabled Item
### Parent Checkbox
### Nested Parent Checkbox
### Form Integration