Checkbox
A gummy checkbox. Tick it and a sakura blooms around the box: five petals unfold one after another, sway for a moment, then let go and drift down.
Installation
❯ npx shadcn@latest add https://yan.moe/r/checkbox.jsonUsage
import { Checkbox } from "@/components/ui/checkbox"<Checkbox defaultChecked aria-label="Pet the mochi" />Pair it with a label. The checkbox is a peer, so siblings can react to its state:
<label className="flex items-center gap-3">
<Checkbox />
<span className="peer-data-[state=checked]:line-through">Ship it</span>
</label>Accessibility
- Built on Radix Checkbox:
role="checkbox", toggles with Space, supports the indeterminate state. - The tick is an inline SVG that inherits
currentColor. - With
prefers-reduced-motion: reduce, the pop, the bloom and the sparkles are skipped.
API
| Prop | Type | Default |
|---|---|---|
intensitykawaii: pop and a sakura bloom. subtle: a few sparkles. off: neither. | "kawaii" | "subtle" | "off" | "kawaii" |
fxOverrides for the sparkles fired in subtle mode. | BurstOptions | - |
checked / defaultCheckedControlled and uncontrolled state, as in Radix. | boolean | "indeterminate" | - |
onCheckedChangeCalled when the state changes. | (checked: CheckedState) => void | - |