Checkbox
Layers a neumorphic surface over a transparent native input to preserve form submission and browser accessibility. Supports controlled, uncontrolled, and indeterminate states with a shadcn-style onCheckedChange callback.
@neumorphism-ui/checkboxPreview
Installation
Installation: checkbox
npx shadcn@latest add @neumorphism-ui/checkboxThe CLI resolves npm dependencies, base tokens, utilities, and component source in order.
New to this Registry? Set up the namespace before continuing.
Usage
Usage: Installation
npx shadcn@latest add @neumorphism-ui/checkbox @neumorphism-ui/labelImport
Checkbox import code
import { Checkbox } from "@/components/ui/checkbox"
import { Label } from "@/components/ui/label"Example
Checkbox usage code
<div className="flex items-center gap-2"> <Checkbox id="updates" defaultChecked /> <Label htmlFor="updates">Receive product updates</Label> </div>
API Reference
| Component | Prop | Type | Default | Description |
|---|---|---|---|---|
Checkbox | checked | boolean | "indeterminate" | — | The controlled checked or mixed state. |
Checkbox | defaultChecked | boolean | false | The initial checked state for uncontrolled usage. |
Checkbox | onCheckedChange | (checked: boolean | "indeterminate") => void | — | Called when the checked state changes. |
Checkbox | disabled | boolean | false | Disables input and pointer interaction. |
Checkbox | name / value / required | native input props | — | Native checkbox attributes used for form submission. |
Accessibility
- 01
A real input[type=checkbox] preserves form submission and keyboard interaction with Space.
- 02
Connect Label htmlFor to the Checkbox id, or place Checkbox inside a label.
- 03
In the indeterminate state, both aria-checked=mixed and the DOM indeterminate property are set.