Checkbox

A checkbox with a swelling fill and a check that draws itself.

checkbox.tsx

Installation

1

Install the packages

npm install @prequelui/react motion

@prequelui/react reuses the primitive library your components already depend on.

2

Add the component

npx shadcn@latest add https://animate.prequelui.terravidhal.me/r/checkbox.json

npx shadcn@latest add https://animate.prequelui.terravidhal.me/r/checkbox.json

3

Turn on the motion

npx @prequelui/cli@latest animate checkbox

The CLI finds the component through components.json, swaps the import and removes the CSS animation classes that Motion replaces.

Usage

Import the component and compose it exactly like the primitive it wraps. Motion is enabled by default; the tempo prop scales every duration and softens every spring.

checkbox.tsx
import { Checkbox } from "@/components/prequelui/checkbox";

export default function Demo() {
  return (
    <label className="flex items-center gap-3 text-[13.5px]">
      <Checkbox defaultChecked />
      Send me product updates
    </label>
  );
}
import { Checkbox } from "@/components/prequelui/checkbox";

export function Variant() {
  return (
    <Checkbox tempo={1.2}>
      …
    </Checkbox>
  );
}

Animation

A filled pill grows under the check first, then the stroke draws itself from the first point to the last. The fill and the border colour move together so the box never shows an empty checked state.

  • Fill: a 500 / 24 spring on scale and opacity.
  • Check: 300 ms with the draw curve, delayed 200 ms after the fill.
  • Unchecking removes the stroke in the same 300 ms window.
  • The indeterminate state draws a single horizontal line.
  • Reduced motion shows the final state without the draw.
check 300 msdelay 200 msspring 500 / 24draw curve

API Reference

Every part takes exactly the props of the Checkbox primitive. The animated surface adds only motion props, so the accessibility tree and keyboard behaviour stay the same.

Checkbox

PropTypeDefault
checkedboolean—
defaultCheckedbooleanfalse
indeterminatebooleanfalse
onCheckedChange(checked: boolean) => void—
disabledbooleanfalse
classNamestring—

Built by Vidhal. The source is available on GitHub.

Last updated: 11/17/2026