Checkbox Group

Vertical wrapper that groups related checkboxes under role group with even spacing. Use it with Checkbox and labels for multi select settings.

src/registry/ui/checkbox-group.tsx/r/checkbox-group.json

Installation#

bash
npx shadcn@latest add @minidev/checkbox-group

MiniDev UI is in the shadcn registry directory, so the short form works with no setup. Older CLI versions can use the full URL: npx shadcn@latest add https://ui.minidev.pro/r/checkbox-group.json

Usage#

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

export function Example() {
  return (
    <CheckboxGroup>
      <div className="flex items-center gap-2"><Checkbox id="g1" /><Label htmlFor="g1">Email</Label></div>
      <div className="flex items-center gap-2"><Checkbox id="g2" defaultChecked /><Label htmlFor="g2">SMS</Label></div>
      <div className="flex items-center gap-2"><Checkbox id="g3" /><Label htmlFor="g3">Push</Label></div>
    </CheckboxGroup>
  )
}

API reference#

Also accepts every prop of <div>, passed through to the root element.

Examples#

All form components

Learn more