Checkbox
Checkbox with a drawn-on checkmark and indeterminate state.
Installation
npx shadcn@latest add https://neonkit.heyaadi.com/r/checkbox.jsonUsage
import { Checkbox } from "@/components/ui/checkbox"
<Checkbox label="Accept terms and conditions" />Examples
Select all
indeterminate shows a dash on the parent while only some children are checked.
Sizes
Colors
Pass a palette name or any hex value to color.
Disabled
API reference
Renders a native checkbox input. className and style go to the outer label; every other native input attribute goes to the input, which also receives the ref.
| Prop | Type | Default |
|---|---|---|
checked | booleanControlled checked state. | None |
defaultChecked | booleanInitial state when uncontrolled. | false |
onCheckedChange | (checked: boolean) => voidCalled with the new state on every toggle. | None |
indeterminate | booleanShows a dash and reports a mixed state. Takes priority over checked visually. | false |
label | ReactNodeText beside the box. Clicking anywhere on the row toggles it. | None |
description | ReactNodeSecondary text under the label, linked with aria-describedby. | None |
color | NeonColorPalette name or hex. Falls back to --neon-accent, then cyan. | inherited |
size | "sm"Box of 16, 20 or 24px with matching text. | "md" |
disabled | booleanBlocks interaction and dims the row. | false |
Accessibility
- A form reset puts the box back to where it started and calls onCheckedChange, so a controlled parent stays in sync.
- The native input reaches 6px past the box, so a bare checkbox in a dense table is easier to hit.
- It is a real input, so Space toggles it, forms submit it and name, value and required work as usual.
- The label is wired with aria-labelledby, so the description is announced as a description rather than as part of the name.
- Indeterminate sets the native indeterminate property, which screen readers announce as mixed.
- Without a label, pass an aria-label.