GitHub Button Group
Segmented button group displaying multiple GitHub repo metrics (stars, forks, watchers, issues) with per-segment links.
class-variance-authority
Preview
Installation
$ shadcn add https://ui.justinlevine.me/r/github-button-group.jsonUsage
import { GitHubButtonGroup } from "@/components/github-button-group"<GitHubButtonGroup owner="shadcn-ui" repo="ui" />Async server component. Fetches all repo metrics in a single GitHub API call at build time, cached for 1 hour.
Playground
import { GitHubButtonGroup } from "@/components/github-button-group"
<GitHubButtonGroup owner="shadcn-ui" repo="ui" />Examples
Variants
Default
Secondary
Outline
With repo name
Default + Repo
Secondary + Repo
Outline + Repo
Custom metrics
Stars + Forks
Secondary — Stars + Forks
All Metrics
Icon styles
GitHub Green
Copilot Purple
Secondary + GitHub Green
Secondary + Copilot Purple
API Reference
GitHubButtonGroup
PropType
Notes
- Each metric segment links to the corresponding GitHub page (stargazers, forks, watchers, or issues).
- Returns
nullif the GitHub API call fails — handle with a Suspense boundary or fallback.