Skip to content

GitHub Contributions

A GitHub-style contribution calendar in greys where your busiest days bloom into blue, with a hover readout for each day.

2 variantsProNew

Preview

Preview

Installation

GitHub Contributions is part of Floret Pro. It follows Floret's theme tokens, so light and dark mode work out of the box.

Floret ProPro

Your license unlocks this component and all of its source. Sign in once, then install it with the CLI. Follow the steps below.

  1. Sign in with your license

    Paste the key from your purchase email. Once per computer.

    pnpm dlx @shipped-ui/floret login <license-key>
  2. Add GitHub Contributions

    The CLI checks your license, then copies the source with every dependency and theme token.

    pnpm dlx @shipped-ui/floret add github-contributions

Usage

Pass your own data and wire the callbacks to your app.

import { GitHubContributions } from "@/components/ui/github-contributions";

// Fetch on the server so your token never reaches the browser.
async function getContributions(login: string) {
  const res = await fetch("https://api.github.com/graphql", {
    method: "POST",
    headers: { Authorization: `Bearer ${process.env.GITHUB_TOKEN}` },
    body: JSON.stringify({
      query: `query($login: String!) { user(login: $login) {
        contributionsCollection { contributionCalendar {
          weeks { contributionDays { date contributionCount } }
        } } } }`,
      variables: { login },
    }),
    next: { revalidate: 3600 },
  });
  const { data } = await res.json();
  return data.user.contributionsCollection.contributionCalendar.weeks
    .flatMap((w: any) => w.contributionDays)
    .map((d: any) => ({ date: d.date, count: d.contributionCount }));
}

export default async function Profile() {
  return <GitHubContributions days={await getContributions("octocat")} />;
}

Props

PropTypeDefaultDescription
daysContributionDay[]—One entry per day, oldest first, starting on a Sunday — the order GitHub's calendar API returns.
loadingbooleanfalseShows a pulsing skeleton grid while you fetch.
classNamestring—The graph fills its container's width.
export type ContributionDay = {
  date: string;   // "2026-11-23"
  count: number;
  level?: number; // 0–4; worked out from count when left out
};

// Also exported: the GitHub-style bucketing used when level is left out.
export function contributionLevel(count: number): number;