Checkbox
Checkbox Group
NewA group of checkboxes with a legend, two-line options and a Select all row that shows a mixed state.
npx motionsnack add checkbox-groupCustomize
<CheckboxGroup />Props
20 properties
| Property | Type | Default | Description |
|---|---|---|---|
| options | { value: string; label: string; description?: string; disabled?: boolean }[] | 4 demo options | The checkboxes. |
| value | string[] | - | Controlled checked values. Leave undefined to let the component manage them. |
| defaultValue | string[] | ['projects', 'invoices'] | Checked values on first render when uncontrolled. |
| onChange | (value: string[]) => void | - | Called with all checked values whenever one changes. |
| name | string | - | Name submitted with a form; every checked box sends one value. |
| id | string | generated | Id prefix of the checkboxes. |
| className | string | '' | Extra classes on the fieldset. |
| label | string | 'Notifications' | Legend above the group. Empty hides it. |
| description | string | 'Choose what we e-mail you about.' | Line under the legend. Empty hides it. |
| showSelectAll | boolean | true | A row on top that checks or clears every option, with a mixed state. |
| selectAllLabel | string | 'Select all' | Text of the Select all row. |
| maxSelected | number | 0 | Most boxes that can be checked. 0 means no limit. |
| limitText | string | 'Choose up to {n}.' | Helper shown when the limit is reached. {n} is the number. |
| layout | 'vertical' | 'horizontal' | 'vertical' | Options under each other or side by side. |
| size | 'sm' | 'md' | 'md' | Size of the boxes. |
| helperText | string | 'You can change this any time in your settings.' | Small text under the group. Empty hides it. |
| error | string | '' | Error message. Any text colours the unchecked boxes' edge and replaces the helper text. |
| errorColor | string | '' | Overrides the per-theme error colour. Empty uses the theme pair. |
| required | boolean | false | At least one box must be checked. |
| disabled | boolean | false | Disables the whole group. |
About Checkbox Group
Checkbox Group is the plain, reliable way to ask several yes-or-no questions at once: notification settings, consents, features to include. A legend and a short description sit on top, and each option can carry a second line under its label. An optional Select all row checks or clears everything and shows a dash while only some options are on. Ticks draw themselves in and the dash grows from the middle, the boxes come in two sizes, and the options stack or sit side by side. Every box is a real checkbox underneath, so keyboard, screen readers and forms work as usual, and the group shares the library's legend, helper text, error state and soft focus outline.
What's included
- Select all row with a mixed state
- Ticks that draw themselves in
- Two-line options and disabled options
- Vertical or horizontal layout, 16 or 18 px boxes
- Helper text and error state
- Real checkboxes: keyboard, forms, screen readers
- Light and dark look
- Type
- Animated React checkbox component
- Library
- Components · Checkbox
- Stack
- Next.js, React, Tailwind CSS
- Added
- 2026-11-23
- Install
npx motionsnack add checkbox-group