Skip to content

GitHub Star Button

An interactive button that shows GitHub repository stars with smooth animations on hover.

Installation

pnpm dlx shadcn@latest add https://ui.sanjid.shop/r/star-button.json

Props

PropTypeRequiredDefaultDescription
ownerstringYesGitHub repository owner/organization name
repostringYesGitHub repository name
classNamestringNoOptional class name to append to the button element

Features

  • Displays live star count from GitHub API
  • Smooth hover and tap animations
  • Responsive design
  • Animated star icon on hover
  • Formatted star count (e.g., 1.5k for 1500 stars)

Usage

1"use client";2
3import { GithubStarButton } from "@/components/ui/github-star-button";4
5export function MyComponent() {6  return (7    <div className="flex items-center justify-center p-8">8      <GithubStarButton owner="shadcn" repo="ui" />9    </div>10  );11}

Customization

You can customize the button's appearance by passing a custom className:

1<GithubStarButton2  owner="shadcn"3  repo="ui"4  className="bg-gradient-to-r from-blue-600 to-indigo-600 hover:from-blue-700 hover:to-indigo-700"5/>

Notes

  • The component makes an API call to GitHub to fetch the current star count
  • The star count is cached by GitHub's API, so it may not update in real-time
  • For frequent updates, consider implementing client-side caching or using GitHub's webhooks

Build your next big idea with us

From lightning-fast landing pages to fully functional SaaS products, we turn your vision into reality. Book a call today and let's make something extraordinary.

They transformed our idea into a fully functional product in record time. Couldn't be happier!

Alex Chen

Founder, StartupX

The team's attention to detail and design expertise set our product apart in the market.

Sarah Kim

CTO, Innovate Inc