A highlight that sweeps across a surface on hover or click.
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/shine.jsonnpx shadcn@latest add https://animate.prequelui.terravidhal.me/r/shine.json
Turn on the motion
npx @prequelui/cli@latest animate shineThe 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 { Shine } from "@/components/prequelui/effects/shine";
export default function Demo() {
return (
<Shine enableOnHover loop loopDelay={450} className="rounded-xl border px-5 py-3">
Hover for a shine
</Shine>
);
}import { Shine } from "@/components/prequelui/shine";
export function Variant() {
return (
<Shine tempo={1.2}>
…
</Shine>
);
}Animation
A skewed light band rests outside the left edge and crosses the surface when the trigger fires. The overlay is remounted for every pass, so a second hover or a loop never queues behind an unfinished pass.
- Default pass: 1200 ms with a [0.4, 0, 0.2, 1] curve and a −15° skew.
- Triggers can be always-on, hover, tap or any combination.
- Looping reschedules after an optional loopDelay instead of repeating inside the tween.
- Reduced motion removes the overlay entirely.
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.
Shine
| Prop | Type | Default |
|---|---|---|
| color | string | "currentColor" |
| opacity | number | 0.3 |
| duration | number | 1200 |
| delay | number | 0 |
| loop | boolean | false |
| loopDelay | number | 0 |
| deg | number | -15 |
| enableOnHover | boolean | false |
| enableOnTap | boolean | false |
| asChild | boolean | false |