Components

Checkbox

An animated React checkbox built on shadcn/ui and Radix: the drop-in Checkbox draws its check mark with an SVG stroke and supports indeterminate — plus Motion blocks for a to-do item that strikes its label through, and selectable checkbox cards that trace their outline.

  • Drop-in shadcn API
  • Radix Checkbox
  • SVG pathLength
  • Indeterminate
  • prefers-reduced-motion

Due today · Marketing

Tomorrow

Friday

Installation

$ npx shadcn@latest add https://duskui.com/r/checkbox.json

Replaces components/ui/checkbox.tsx with the same API. The check animation is pure CSS (stroke-dashoffset on a pathLength path), so uncontrolled checkboxes and form resets keep working.

Usage

terms.tsx
import { Checkbox } from "@/components/ui/checkbox"

export function Terms() {
  return (
    <div className="flex items-center gap-2">
      <Checkbox id="terms" />
      <label htmlFor="terms">Accept terms and conditions</label>
    </div>
  )
}

Examples

Default

The check draws itself when ticked and erases faster when cleared. Link hints with aria-describedby.

One email a month. Unsubscribe anytime.

Indeterminate

Pass checked="indeterminate" for a partial selection; a dash draws in instead of the check. A classic “select all” for lists and tables.

1/3

Blocks

Ready-made variations composed from the base component with Motion. Each installs on its own and pulls in its dependencies automatically.

Task Checkbox

A to-do row. Checking it draws the check, strikes the label through from left to right — across every wrapped line, one after another — and dims the text. Set celebrate for a small ring and particle burst around the box. The whole label is the click target.

Due today · Marketing

Tomorrow

Friday

$ npx shadcn@latest add https://duskui.com/r/task-checkbox.json
PropTypeDefaultDescription
labelReactNode—The task text. Required.
descriptionReactNode—Secondary line, linked with aria-describedby.
checked / onCheckedChangeboolean | "indeterminate"—Controlled state.
defaultCheckedboolean | "indeterminate"falseUncontrolled initial state.
celebratebooleanfalseSmall ring + particle burst when checked.
containerClassNamestring—Classes for the row; className styles the checkbox.

Checkbox Card

A selectable card for plans, add-ons and multi-select options. Selecting it traces a mint outline around the card (an SVG rect drawn with pathLength) and draws the check. The card is announced as one checkbox named by its title.

Add-ons
$ npx shadcn@latest add https://duskui.com/r/checkbox-card.json
PropTypeDefaultDescription
titleReactNode—Card title; becomes the checkbox's accessible name.
descriptionReactNode—Supporting text, linked with aria-describedby.
iconReactNode—Leading icon element.
childrenReactNode—Extra content under the description (price, badges).
checked / defaultChecked / onCheckedChangeboolean | "indeterminate"—Same as Checkbox.
name / value / required / disabledCheckbox props—Forwarded to the checkbox for forms.
containerClassNamestring—Classes for the card; className styles the checkbox.

API Reference

Checkbox forwards every Radix Checkbox prop, exactly like shadcn/ui. Style states with data-[state=checked], data-[state=indeterminate] and aria-invalid.

PropTypeDefaultDescription
checkedboolean | "indeterminate"—Controlled state.
defaultCheckedboolean | "indeterminate"falseUncontrolled initial state.
onCheckedChange(checked: boolean | "indeterminate") => void—Called when the user toggles it.
name / value / requiredstring / string / boolean—Form submission, via a hidden input inside forms.
disabledbooleanfalseDims the checkbox and blocks interaction.

Accessibility

  • Built on Radix Checkbox: a button with role="checkbox" and aria-checked (including "mixed" for indeterminate), toggled with Space.
  • Label every checkbox with <label htmlFor>; Task Checkbox and Checkbox Card wire labels and descriptions for you.
  • The animated mark, outline and particles are aria-hidden and never intercept clicks.
  • Under prefers-reduced-motion the mark appears instantly, the strike-through doesn't animate and the burst is skipped.