Docs menu

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.json

Usage

tsx
import { Checkbox } from "@/components/ui/checkbox"
tsx
<Checkbox defaultChecked aria-label="Pet the mochi" />

Pair it with a label. The checkbox is a peer, so siblings can react to its state:

tsx
<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

PropTypeDefault
intensity

kawaii: pop and a sakura bloom. subtle: a few sparkles. off: neither.

"kawaii" | "subtle" | "off""kawaii"
fx

Overrides for the sparkles fired in subtle mode.

BurstOptions-
checked / defaultChecked

Controlled and uncontrolled state, as in Radix.

boolean | "indeterminate"-
onCheckedChange

Called when the state changes.

(checked: CheckedState) => void-