# Checkbox Group

<FrameworkCodeSwitcher>
  <div slot="astro">
```astro
---
import { Checkbox } from "@/components/starwind/checkbox";
import { CheckboxGroup } from "@/components/starwind/checkbox-group";
---

<CheckboxGroup defaultValue={["email"]} aria-label="Notification channels">
  <Checkbox name="notifications" value="email" label="Email" />
  <Checkbox name="notifications" value="sms" label="SMS" />
  <Checkbox name="notifications" value="push" label="Push" />
</CheckboxGroup>
```
  </div>
  <div slot="react">
```tsx
import { Checkbox } from "@/components/starwind/checkbox";
import { CheckboxGroup } from "@/components/starwind/checkbox-group";

export function Example() {
  return (
    <CheckboxGroup defaultValue={["email"]} aria-label="Notification channels">
      <Checkbox name="notifications" value="email" label="Email" />
      <Checkbox name="notifications" value="sms" label="SMS" />
      <Checkbox name="notifications" value="push" label="Push" />
    </CheckboxGroup>
  );
}
```
  </div>
  <div slot="vue">
```vue
<script setup lang="ts">
import { Checkbox } from "@/components/starwind/checkbox";
import { CheckboxGroup } from "@/components/starwind/checkbox-group";
</script>

<template>
  <CheckboxGroup :defaultValue="['email']" aria-label="Notification channels">
    <Checkbox name="notifications" value="email" label="Email" />
    <Checkbox name="notifications" value="sms" label="SMS" />
    <Checkbox name="notifications" value="push" label="Push" />
  </CheckboxGroup>
</template>
```
  </div>
</FrameworkCodeSwitcher>

## Installation

```bash
npx starwind@latest add checkbox-group --framework astro
```
</DocsTabsContent>
```bash
npx starwind@latest add checkbox-group --framework react
```
</DocsTabsContent>
```bash
npx starwind@latest add checkbox-group --framework vue
```
</DocsTabsContent>
</DocsTabs>

## Usage

Use `disabled` on the group to disable every child without repeating the prop.

<FrameworkCodeSwitcher>
  <div slot="astro">
```astro
---
import { Checkbox } from "@/components/starwind/checkbox";
import { CheckboxGroup } from "@/components/starwind/checkbox-group";
---

<CheckboxGroup disabled aria-label="Unavailable channels">
  <Checkbox value="email" label="Email" />
  <Checkbox value="sms" label="SMS" />
</CheckboxGroup>
```
  </div>
  <div slot="react">
```tsx
import { Checkbox } from "@/components/starwind/checkbox";
import { CheckboxGroup } from "@/components/starwind/checkbox-group";

export function Example() {
  return (
    <>
      <CheckboxGroup disabled aria-label="Unavailable channels">
        <Checkbox value="email" label="Email" />
        <Checkbox value="sms" label="SMS" />
      </CheckboxGroup>
    </>
  );
}
```
  </div>
  <div slot="vue">
```vue
<script setup lang="ts">
import { Checkbox } from "@/components/starwind/checkbox";
import { CheckboxGroup } from "@/components/starwind/checkbox-group";
</script>

<template>
  <CheckboxGroup disabled aria-label="Unavailable channels">
    <Checkbox value="email" label="Email" />
    <Checkbox value="sms" label="SMS" />
  </CheckboxGroup>
</template>
```
  </div>
</FrameworkCodeSwitcher>

## API Reference
### CheckboxGroup
| Prop | Type | Required | Default | Kind | Description |
| --- | --- | --- | --- | --- | --- |
| `defaultValue` | `string[]` | No | - | Primitive override | Sets the initial value when the component is uncontrolled. |
- Inherits div attributes. Omits `defaultValue` and `onChange`.
### Primitive And Runtime API
Behavior, state, events, form participation, and imperative methods are documented in the lower-level references.
- Primitive: [Checkbox Group Primitive](/docs/primitives/checkbox-group/)
- Runtime factory: [`createCheckboxGroup`](/docs/runtime/#create-checkbox-group) from `@starwind-ui/runtime/checkbox-group`

## Changelog

### v1.0.1

- Updated React Runtime state synchronization so canceled proposals stay uncommitted and accepted changes remain aligned.

### v1.0.0

- Added Checkbox Group as a Runtime-backed component with grouped ownership and native form participation.
- See the [Checkbox Group Primitive](/docs/primitives/checkbox-group/) for the underlying unstyled anatomy and behavior API.