A compact star button with a counting number and fill.
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/github-stars-button.jsonnpx shadcn@latest add https://animate.prequelui.terravidhal.me/r/github-stars-button.json
Turn on the motion
npx @prequelui/cli@latest animate github-stars-buttonThe 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 { GitHubStarsButton } from "@/components/prequelui/github-stars-button";
export default function Demo() {
return (
<GitHubStarsButton
username="prequelui"
repo="prequelui-animate"
value={1284}
inView
/>
);
}import { GitHubStarsButton } from "@/components/prequelui/github-stars-button";
export function Variant() {
return (
<GitHubStarsButton tempo={1.2}>
…
</GitHubStarsButton>
);
}Animation
The compact star button counts up to its published value when it enters the viewport. Starring it changes the count by one, fills the star gold and releases a ring of six particles from the icon.
- Count spring: stiffness 90, damping 50, displayed as tabular numerals.
- Star pop: 450 ms with a short scale and rotate overshoot.
- Particles: 600 ms, 26 px travel, fade to zero.
- Reduced motion writes the final count and skips the particles.
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.