A ring, ripple, crosshair or burst played at the click point.
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/click.jsonnpx shadcn@latest add https://animate.prequelui.terravidhal.me/r/click.json
Turn on the motion
npx @prequelui/cli@latest animate clickThe 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 { Click } from "@/components/prequelui/effects/click";
export default function Demo() {
return (
<Click variant="ring" size={100} duration={400}>
<div className="grid h-40 place-items-center rounded-xl border border-dashed">
Click anywhere
</div>
</Click>
);
}import { Click } from "@/components/prequelui/click";
export function Variant() {
return (
<Click tempo={1.2}>
…
</Click>
);
}Animation
A pointer press spawns one short-lived effect at the exact viewport point, in a fixed overlay that ignores the pointer. Five variants share the same timing controls but use different geometry: a filled ripple, an expanding ring, a crosshair, a radial burst and a ring of dots.
- Default duration: 400 ms, with the overlay removed 320 ms after the animation.
- The ripple scales from 0.2 to 1 and fades; the ring grows while its stroke thins to zero.
- The crosshair and the burst travel outwards on an ease-in-out and shrink as they fade.
- No listener and no overlay is created when reduced motion is active.
API Reference
Each part accepts the usual HTML props in addition to the motion props below. No accessibility prop is hidden behind the animation layer.
Click
| Prop | Type | Default |
|---|---|---|
| variant | "ripple" | "ring" | "crosshair" | "burst" | "particles" | "ring" |
| size | number | 100 |
| duration | number | 400 |
| color | string | "currentColor" |
| disabled | boolean | false |
| scope | RefObject<HTMLElement> | document |
| children | ReactNode | — |