Components/Forms
Checkbox with a drawn-on checkmark and indeterminate state.
Installation#
npx shadcn@latest add https://get-neonkit.vercel.app/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#
Checkbox
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. | — |
defaultChecked | booleanInitial state when uncontrolled. | false |
onCheckedChange | (checked: boolean) => voidCalled with the new state on every toggle. | — |
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. | — |
description | ReactNodeSecondary text under the label, linked with aria-describedby. | — |
color | NeonColorPalette name or hex. Falls back to --neon-accent, then cyan. | inherited |
size | "sm" | "md" | "lg"Box of 16, 20 or 24px with matching text. | "md" |
disabled | booleanBlocks interaction and dims the row. | false |
Accessibility#
- 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.