Checkbox
A control that allows the user to toggle between checked and not checked.
Installation#
pnpm dlx shadcn@latest add @davinciui/checkboxUsage#
API Reference#
| Prop | Type | Default |
|---|---|---|
checkedControlled checked state. | boolean | — |
defaultCheckedUncontrolled initial state. | boolean | false |
disabledDisables the checkbox. Announced as disabled. | boolean | false |
invalidError state. Sets aria-invalid + destructive styling. | boolean | false |
indeterminateTri-state dash for select-all parents. Reports aria-checked=mixed. | boolean | false |
requiredNative required constraint (e.g. consent checkboxes). | boolean | false |
CheckboxFieldLink-safe row layout (flex, gap-3). Pair Checkbox with Label/Content inside. | Component | — |
CheckboxLabelLabel bound via htmlFor. Clicking toggles the checkbox. | Component | — |
CheckboxContentStacks label, description and error with consistent spacing. | Component | — |
CheckboxDescriptionHelper text. Tie via aria-describedby on the input. | Component | — |
CheckboxErrorError message with role=alert. Tie via aria-describedby. | Component | — |
CheckboxGroupfieldset + legend semantics. Props: legend, description, errorText, invalid, required, orientation. | Component | — |
classNameAdditional CSS classes. | string | — |
Accessibility#
A native checkbox stays in the DOM, visually hidden inside its label, so Space toggles it and focus-visible styling shows. Indeterminate sets aria-checked mixed, and CheckboxGroup uses fieldset and legend with aria-describedby.
Motion#
The box transitions border, background and shadow over 150ms ease-out while the check icon scales and fades in over 150ms. motion-reduce sets transition-none on both.
View source
Keep in mind
Need a custom component?
I build bespoke UI components & websites tailored to your brand.

