ContributionGraph

GitHub-style activity heatmap — a year of days as a 7×N grid of intensity cells.

import { ContributionGraph } from "@ps1ui/core";

Basic

const data = [
  { date: "2025-01-01", count: 0 },
  { date: "2025-01-02", count: 3 },
  { date: "2025-01-03", count: 7 },
  // ...one entry per day, sorted ascending, contiguous...
  { date: "2025-12-30", count: 5 },
  { date: "2025-12-31", count: 12 },
];

<ContributionGraph data={data} />

Monday start

<ContributionGraph data={data} weekStartsOn="monday" />

Larger cells

<ContributionGraph
  data={data}
  cellSize={16}
  cellGap={4}
  cellRadius={3}
/>

Without labels or legend

<ContributionGraph
  data={data}
  showMonthLabels={false}
  showWeekdayLabels={false}
  showLegend={false}
/>

Custom day label

<ContributionGraph
  data={data}
  labelForDay={(day) =>
    day.count > 0
      ? `${day.date}${day.count} commit${day.count === 1 ? "" : "s"}`
      : `${day.date} → no activity`
  }
/>

Props

PropTypeDefaultDescription
data*ContributionDay[]

Sorted days to render (ascending by date). Gaps are allowed — each day lands at its actual weekday and columns spanning purely-missing days simply render empty.

weekStartsOn"sunday" | "monday""sunday"

First day of each week column.

cellSizenumber11

Cell side length in pixels.

cellGapnumber3

Gap between cells in pixels.

cellRadiusnumber2

Cell corner radius in pixels.

showMonthLabelsbooleantrue

Render month labels above the grid.

showWeekdayLabelsbooleantrue

Render weekday labels beside the grid.

showLegendbooleantrue

Render a Less/More legend under the grid.

labelForDay(day: ContributionDay) => stringdefaultLabelForDay

Text for a cell — used both as the cell's accessible name and as its hover/focus tooltip. Defaults to "N contributions on Month Nth." — "No contributions" when count is zero, singular when count is one.

All native <div> attributes are also accepted.