About the shadcn/ui Checkbox Component

The Checkbox component is part of shadcn/ui — a collection of accessible, copy-paste React components built with Radix UI and Tailwind CSS. Install it with `npx shadcn@latest add checkbox` and copy it directly into your project.

Checkbox Component — Frequently Asked Questions

How do I handle checkbox groups with shadcn Checkbox?

Manage an array of checked values in state, then for each checkbox use `checked={values.includes(id)}` and `onCheckedChange` to toggle items in the array.

How do I use the indeterminate state in shadcn Checkbox?

Set `checked="indeterminate"` on `<Checkbox>`. This is useful for 'select all' checkboxes when only some child items are selected.

How do I integrate shadcn Checkbox with React Hook Form?

Use `<Controller>` or spread register: for the Form variant use `<FormField>` which handles the Radix UI checked/onCheckedChange API automatically.