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.json

Usage

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

Props

import { GitHubButtonGroup } from "@/components/github-button-group"

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

Examples

Custom metrics

Stars + Forks

Secondary — Stars + Forks

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 null if the GitHub API call fails — handle with a Suspense boundary or fallback.