GitHub Activity React chart component for Tailwind CSS v4
v1.0.1Updated in 1.2.1
A React GitHub contribution graph: a yearly heatmap with a panel of your top repositories.
The grid sweeps in column by column, then the month labels blur into focus. Hover any cell, or press one on a touchscreen, for its count and date. Click the chevron to expand the top repositories over the grid, their avatars flying out of the stack into rows, and again to fold them back. The grid shows as many recent weeks as fit its width, so it never scrolls sideways on a phone.
GitHub Activity is a free React chart component in the React chart and stat components category, written in TypeScript for React 19 and Tailwind CSS v4. It installs as source with npx wingo-ui@latest add github-activity, together with UIProvider and the npm package motion.
Add to a project
Requirements: React 19 and Tailwind CSS v4, in Next.js (App Router or Pages), Vite or React Router. Installation guide · Next.js setup · Vite setup
npx wingo-ui@latest add github-activityUsage
Import GitHubActivity from @/components/ui/github-activity.
import GitHubActivity from "@/components/ui/github-activity"
export function Demo() {
return <GitHubActivity username="octocat" />
}
// or pass everything yourself:
// <GitHubActivity
// contributions={contributions}
// repos={[{ name: "Zero mail", count: 412, logo: <ZeroIcon /> }]}
// accent={["#0e4429", "#006d32", "#26a641", "#39d353"]}
// />Props
usernamedefault""stringA GitHub username to load the last year of contributions and the most-pushed repositories for, from public APIs. Ignored for whichever of contributions or repos you pass yourself. An unknown or invalid name shows a not found heading and calls onError.
contributionsdefault"[]"Contribution[]Your own contribution data, one { date, count, level } per day in date order, starting on a Sunday. Level 0 to 4 picks the shade.
reposdefault"[]"RepoContribution[]The repositories listed in the footer, highest first: { name, count, logo?, href? }. The first avatarCount (3) stack as avatars; a missing logo shows the initial.
yeardefault0numberOverrides the year in the heading. 0 uses the year of the latest contribution (2025 in this sample).
accentdefault"#39d353"string | string[]The color of the contribution squares. One color is faded per level; an array of four shades (or five, with the empty color first) sets each level exactly.
cellSizedefault11numberSize of each day square in pixels. The gap scales with it.
cellRadiusdefault3numberCorner radius of each day square in pixels.
backgrounddefault""stringAny CSS color for the card. Empty is white in light mode and black in dark mode. The heading and the panel keep the theme colors, so pick a background that suits the theme.
radiusdefault28numberCorner radius of the card in pixels; the repository panel inside follows it minus 10px.
chevronColordefault""stringAny CSS color for the round chevron that opens the panel. Empty uses #C4C9CC light, #3E4346 dark. It keeps a 44px hit area on touch screens.
avatarCountdefault3numberHow many repository avatars stack in the closed footer (and, with username, how many repositories are fetched).
monthsdefault12numberHow many months of history to show, at most. The grid also drops older weeks that do not fit its width.
showMonthsdefaultfalsebooleanAdds a row of month names above the grid.
labeldefault"Top contributions in:"stringText shown in the footer next to the avatars.
localedefault""stringIntl locale for the month names, the tooltip date and the heading count. Falls back to UIProvider's locale, then en-US.
headingLabeldefault"{count} contributions"stringHeading template; {count} fills in the total.
yearLabeldefault"in {year}"stringAppended to the heading when there is a year; {year} fills in.
notFoundLabeldefault"No public activity found for {login}"stringHeading when username has no public calendar; {login} fills in.
dayLabeldefault"{count} contributions on {date}"stringTooltip template for a day; {count} and {date} fill in.
dayLabelOnedefault"{count} contribution on {date}"stringTooltip template for a day with exactly one contribution.
showReposLabeldefault"Show top repositories"stringAccessible name of the chevron while the panel is closed.
hideReposLabeldefault"Hide top repositories"stringAccessible name of the chevron while the panel is open.
defaultOpendefaultfalsebooleanStarts with the repository panel open. Ignored when open is set.
openbooleanPanel state for controlled usage. When set, the component stops managing its own state.
onOpenChange(open: boolean) => voidCalled with the next state when the chevron is clicked.
onError(username: string) => voidCalled when username is not a valid GitHub login or its calendar cannot be loaded, for example to fall back to data you pass yourself.
classNamestringExtra classes for the card that wraps the grid. Its width fits the visible weeks (at least 320px) and is capped at the parent width; pass max-w-* to show fewer weeks.
Parts
Contribution
typeOne day of contributions: { date: "YYYY-MM-DD", count, level: 0 | 1 | 2 | 3 | 4 }. Pass them oldest first, starting on a Sunday.
RepoContribution
typeOne repository in the footer: { name, count, logo?, href? }.
ContributionLevel
typeThe five intensity steps of a day, 0 (none) to 4 (most).
Examples
Your own color scale
An array of four shades sets each level exactly; showMonths adds the month row.
Last six months, round cells
months 6 with larger cells and a radius of half the cell, in orange.
Repositories open
defaultOpen starts with the top repositories expanded over the grid; the chevron folds them back.
Files
- components/ui/github-activity.tsx
FAQ
Is the React GitHub Activity chart component free?
Yes. The source is free and needs no account: copy it from the Code tab or install it with the CLI.
How do I install GitHub Activity?
Run npx wingo-ui@latest add github-activity. It also adds the Wingo UI item it builds on (UIProvider) and the npm package motion. With shadcn, run npx shadcn@latest add https://wingo-ui.com/r/github-activity.json.
How does GitHub Activity behave on phones?
The grid shows as many recent weeks as fit its width, so it never scrolls sideways on a phone.
See also
Used in
More React chart and stat components
Articles using this component
- Shadcn Profile Page in React: Follow, Tabs and Edit Sheet
Build it: screens and apps9 min read
- React GitHub Contribution Graph: Data, Themes and A11y
Component guides9 min read