GitHub Stars Button

A compact star button with a counting number and fill.

github-stars-button.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/github-stars-button.json

npx shadcn@latest add https://animate.prequelui.terravidhal.me/r/github-stars-button.json

3

Turn on the motion

npx @prequelui/cli@latest animate github-stars-button

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.

github-stars-button.tsx
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.
spring 90 / 50star pop 450 ms6 particlesin-view count

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.

GitHubStarsButton

PropTypeDefault
valuenumber1284
usernamestring"prequelui"
repostring"prequelui-animate"
delaynumber0
inViewbooleantrue

Built by Vidhal. The source is available on GitHub.

Last updated: 11/17/2026