A checkbox with a swelling fill and a check that draws itself.
Installation
Install the packages
npm install @prequelui/react motion@prequelui/react reuses the primitive library your components already depend on.
Add the component
npx shadcn@latest add https://animate.prequelui.terravidhal.me/r/checkbox.jsonnpx shadcn@latest add https://animate.prequelui.terravidhal.me/r/checkbox.json
Turn on the motion
npx @prequelui/cli@latest animate checkboxThe 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.
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.
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
| Prop | Type | Default |
|---|---|---|
| checked | boolean | — |
| defaultChecked | boolean | false |
| indeterminate | boolean | false |
| onCheckedChange | (checked: boolean) => void | — |
| disabled | boolean | false |
| className | string | — |