8.4k

Checkbox Group

Provides shared state to a series of checkboxes.

API Reference

Installation

pnpm dlx shadcn@latest add https://coss.com/ui/r/checkbox-group.json

Usage

import { Checkbox } from "@/components/ui/checkbox"
import { CheckboxGroup } from "@/components/ui/checkbox-group"
<CheckboxGroup>
  <Label>
    <Checkbox defaultChecked />
    Next.js
  </Label>
  <Label>
    <Checkbox />
    Vite
  </Label>
  <Label>
    <Checkbox />
    Astro
  </Label>
</CheckboxGroup>

Examples

For accessible group labelling and validation, prefer wrapping checkbox groups with Field and Fieldset. See the related example: Checkbox group field.

With Disabled Item

Parent Checkbox

Nested Parent Checkbox

Form Integration

coss.com ui

Built by and for the team of Cal.com, Inc. — the leading commercial open source company (“coss”).