Checkbox
Select one or more independent options.
Installation
Terminal
pnpm dlx shadcn@latest add https://react-toolbox.io/r/checkbox.jsonNew here? Set up your project first. Styles, fonts, and required components are included.
Usage
Use indeterminate for a partially selected collection. Provide a visible label or an aria-label for an otherwise unlabeled control.
State and callbacks
Use checked/onChange for controlled state, or defaultChecked for native form state and reset. onChange receives the next boolean, then the input click event.
API reference
Key props and defaults. Full types and inline documentation are included with the source in material/checkbox.
Checkbox
| Property | Type | Default |
|---|---|---|
indeterminate | booleanA partially selected set; submitted values still follow checked. | false |
label | React.ReactNode | — |
onChange | (checked: boolean, event: React.MouseEvent<HTMLInputElement>) => void | — |
Material guidelines
- Use checkboxes for independent choices in a set. A single setting that takes effect immediately is usually better represented by a switch.
- Keep a clear label beside each option and make the label part of its interaction area.