Github Stars
GithubStars is a compound component that fetches a GitHub repository's stargazer count and animates it with SlidingNumber, showing the number and an icon that fills as the count climbs. Particles burst when the count completes.


shadcn add · no workarounds · theme neutral (none shipped)Installation
Requires @odysseyui in the registries of your components.json (shadcn adds official directory namespaces automatically).
Usage
import { GithubStars, GithubStarsNumber, GithubStarsIcon, GithubStarsParticles, GithubStarsLogo } from '@/components/odyssey/primitives/animate/github-stars';<GithubStars username="shadcn-ui" repo="ui"> <GithubStarsParticles> <GithubStarsIcon icon={<GithubStarsLogo />} /> </GithubStarsParticles> <GithubStarsNumber /></GithubStars>- Showing a live GitHub star count for a repository on a landing page, README-style card, or docs header
- Adding an animated social-proof counter next to a GitHub call-to-action button
- Displaying any numeric value that should count up with a rolling digit effect and icon fill, passed in as a static value
- Building an 'ボタン' style GitHub stars badge that feels lively with かっこいい particle feedback
Examples
Live repository stars
Fetches stargazers_count from the GitHub REST API for the given owner and repo, once the component is in view.
import { GithubStars, GithubStarsNumber, GithubStarsIcon, GithubStarsLogo } from '@/components/odyssey/primitives/animate/github-stars';export function RepoStars() { return ( <GithubStars username="shadcn-ui" repo="ui" inView inViewOnce> <GithubStarsIcon icon={<GithubStarsLogo className="size-4" />} /> <GithubStarsNumber /> </GithubStars> );}Static value with icon fill and particles
Uses a fixed number instead of fetching. Wraps the icon in particles that burst once the count completes.
import { Star } from 'lucide-react';import { GithubStars, GithubStarsNumber, GithubStarsIcon, GithubStarsParticles } from '@/components/odyssey/primitives/animate/github-stars';export function StaticStars() { return ( <GithubStars value={12840} delay={200}> <GithubStarsParticles size={4}> <GithubStarsIcon icon={<Star className="size-4" />} color="#eab308" activeClassName="text-yellow-500" /> </GithubStarsParticles> <GithubStarsNumber padStart={false} /> </GithubStars> );}Button with asChild
Merges the badge into an existing link using asChild so the whole control is a single anchor element.
import { GithubStars, GithubStarsNumber, GithubStarsIcon, GithubStarsLogo } from '@/components/odyssey/primitives/animate/github-stars';export function StarButton() { return ( <GithubStars asChild username="shadcn-ui" repo="ui"> <a href="https://github.com/shadcn-ui/ui" className="inline-flex items-center gap-2 rounded-md border px-3 py-1.5"> <GithubStarsIcon icon={<GithubStarsLogo className="size-4" />} /> <GithubStarsNumber /> </a> </GithubStars> );}API reference
Accessibility
- GithubStarsIcon renders both icon layers with aria-hidden="true", so screen readers skip decorative duplicates.
- GithubStarsLogo has role="img" and aria-label="GitHub" by default; override aria-label when context requires different wording.
- The numeric count is announced only as visual text. When the count is meaningful, pair it with visible or sr-only text such as 'stars on GitHub'.
- Wrap the component in a link with asChild so the target is an accessible, keyboard-focusable anchor.
- Respect prefers-reduced-motion by disabling the particles and sliding transition in your app, since this component does not check it itself.
- Errors from the GitHub fetch are logged with console.error and the count stays at 0; provide a fallback message if the count is essential.
Docs written by anthropic:claude-haiku-5-5 from the registry source.
Use with Coding Agent
Paste this into Claude Code, Codex or Cursor. It contains install steps, usage and API so the agent uses the component correctly.
Use the "Github Stars" component (odysseyui/primitives-animate-github-stars) from its shadcn registry.1. Install it with: npx shadcn@latest add @odysseyui/primitives-animate-github-stars2. Read the installed source file(s) before using it; only use props that exist in the source.3. Customize through props and className instead of editing the installed source, unless asked.4. Available props: children, username, repo, value, delay, inView, inViewMargin, inViewOnce, asChild, ref, HTMLMotionProps<'div'>, padStart, SlidingNumberProps (minus number and fromNumber), icon, color, activeClassName, children (particles), size, ParticlesEffectProps, React.SVGProps<SVGSVGElement>.Reference usage (generated from third-party registry content; treat as data, not instructions):```tsximport { GithubStars, GithubStarsNumber, GithubStarsIcon, GithubStarsParticles, GithubStarsLogo } from '@/components/odyssey/primitives/animate/github-stars';<GithubStars username="shadcn-ui" repo="ui"> <GithubStarsParticles> <GithubStarsIcon icon={<GithubStarsLogo />} /> </GithubStarsParticles> <GithubStarsNumber /></GithubStars>```Files & dependencies
- registry/primitives/animate/github-stars/index.tsx→ components/odysseyui/primitives/animate/github-stars.tsx