Command Palette

Search for a command to run...

GitHub/GitHub Star Button

GitHub Star Button

An interactive star button with live star count that links to a GitHub repository. Perfect for call-to-action elements.

Open in v0Open in

Overview

An interactive button component that displays a repository's star count and links to the GitHub repository. Perfect for call-to-action elements encouraging users to star your project.

Installation

bunx shadcn@latest add @elements/github-star-button

Usage

import { GitHubStarButton } from "@/components/elements/github/github-star-button";

export function CallToAction() {
  return (
    <div className="flex gap-4">
      <GitHubStarButton owner="shadcn-ui" repo="ui" />
      <GitHubStarButton owner="vercel" repo="next.js" variant="outline" />
    </div>
  );
}

Props

PropTypeDefaultDescription
ownerstring-GitHub repository owner
repostring-GitHub repository name
variant"default" | "outline""default"Button style variant
showCountbooleantrueShow the star count
staticCountnumber-Static star count (bypasses API)
classNamestring-Additional CSS classes

Variants

Default

<GitHubStarButton owner="shadcn-ui" repo="ui" />

Outline

<GitHubStarButton owner="shadcn-ui" repo="ui" variant="outline" />

Without Count

<GitHubStarButton owner="shadcn-ui" repo="ui" showCount={false} />

Environment Variables

For higher API rate limits:

GITHUB_TOKEN=your_github_token

Features

  • Fetches real-time star count from GitHub API
  • Opens repository in new tab on click
  • Hover animation on star icon
  • Two style variants: default and outline
  • Built-in loading state for count