This page as markdown: /activity-heatmap.md · Index for agents: /llms.txt · Everything in one file: /llms-full.txt

ActivityHeatmap

Status: stable

A calendar heatmap: one value per day as a grid of weeks by weekdays — the GitHub contribution graph, for any daily measure. Levels by quartile, categories by source, a real ARIA grid with one tab stop, and a sideways scroll on narrow screens that opens on the latest week.

Keywords: heatmap, calendar heatmap, contribution graph, contributions, activity, github, streak, habit, daily, commits, uptime

Usage

Use ActivityHeatmap to show how often something happened day by day over weeks or months: commits, habits kept, orders, uptime. Pass days as ISO dates with a value; levels, colours, labels, keyboard and tooltips work with no further props. Put it inside a Card and compose any totals beside it (NumberTicker, StatRowBlock). For a value over time that a reader needs to compare precisely, use AreaChart or BarChart; for a month calendar with marked days (a streak calendar), use Calendar.

Best practices

Anatomy

Part Required Description
Weekday labels no Short weekday names beside the rows, outside the scroller so the weeks never slide under them.
Month labels no Short month names over each month's first week; they scroll with their weeks.
Cell grid yes A role=grid table, one gridcell per day, inside a horizontal Scroller that opens on the latest week.
Tooltip no The chart tooltip card, anchored to the hovered, focused or tapped day.
Legend no A Less–More ramp for intensity, or swatches for categories.

Props

Name Type Default Description
label string — What the grid shows ("Contributions in 2026") — its caption and accessible name.
data ActivityDay[] | Record<string, number> — The days: { date: "YYYY-MM-DD", value, level?, category? }[], or a map of date to value. Sparse is fine — a missing day is 0; duplicates sum.
start string 53 weeks before end First day drawn, "YYYY-MM-DD". The default starts at the beginning of that week, as GitHub's does.
end string today Last day drawn. Days after today inside the range are drawn hollow and skipped by the keyboard.
year number — Draw Jan 1 – Dec 31 of this year. Wins over start / end.
weekStart 0 | 1 the locale's 0 puts Sunday on the top row, 1 Monday.
levels number 5 How many levels, including the empty level 0.
levelScale "quantile" | "linear" | number[] | ((value, stats) => number) "quantile" How a value becomes a level. Quantile splits the positive values evenly, as GitHub does; an array gives each level's lower bound from 1 up; a function decides. A day's own level always wins.
tone ChartTone "1" The hue of the intensity ramp. Decorative tones lead, as on every chart; "success" gives the GitHub look.
categories ChartCategories — Colour days by day.category (label, tone or colour per key). Pair with levels={2} for flat category colours.
unit string | { one: string; other: string } — Names the value in the tooltip and each cell's accessible name, pluralised with Intl.PluralRules.
formatValue (value: number) => string full to 9,999, compact past Formats a value wherever it is shown or read.
tooltip boolean | ((day: ActivityHeatmapDay) => ReactNode) true Show the tooltip on hover, focus and tap; a function replaces its content on the same card.
legend boolean true The Less–More ramp for intensity, swatches for categories.
legendLabels [string, string] ["Less", "More"] The ramp's end words.
monthLabels boolean true Short month names over each month's first week.
weekdayLabels "alternate" | "all" | "none" "alternate" Which weekday names to show beside the rows; alternate is Mon, Wed, Fri.
size "sm" | "md" | "lg" "md" The smallest a cell may get (10, 12, 14 px) before the grid scrolls instead of shrinking.
stretch boolean true Grow cells to fill the width, up to 20 px. false keeps them at size.
activeDate string | null — The hovered or focused day, controlled. Pair with defaultActiveDate / onActiveDateChange.
selectedDate string | null — The selected day, controlled. Selection is on only when onSelectDate is set.
onSelectDate (date: string) => void — Called when a day is clicked or chosen with Enter / Space — to filter a feed below, as GitHub does.
renderCell (day, cell) => ReactNode — Draw something over a cell's fill — an icon for a milestone, a reward, an outage.
loading boolean false Draw the empty grid, shimmering, while data loads.
motion "full" | "subtle" | "off" "full" Turns the arrival down; subtle shows the finished grid at once.
locale string runtime locale Month and weekday names, numbers and plurals.

Tokens used

foreground, muted-foreground, border-strong, ring, tone-1-mark, tone-2-mark, tone-3-mark, success-mark, tone-info-mark

Motion

Accessibility

Related

Examples

Contributions, last year

import { ActivityHeatmap } from "@sableui/react"

const days = [
	{ date: "2026-10-12", value: 4 },
	{ date: "2026-10-13", value: 11 },
	{ date: "2026-10-14", value: 2 },
]

<ActivityHeatmap label="Contributions in the last year" data={days} tone="success" unit={{ one: "contribution", other: "contributions" }} />

Two sources, in a card

import { ActivityHeatmap, Card, CardContent, CardHeader, CardTitle, mergeActivity } from "@sableui/react"

const github = [{ date: "2026-10-13", value: 6 }]
const codex = [{ date: "2026-10-13", value: 1 }, { date: "2026-10-14", value: 3 }]

<Card>
	<CardHeader>
		<CardTitle>Building, day by day</CardTitle>
	</CardHeader>
	<CardContent>
		<ActivityHeatmap
			label="GitHub and Codex activity in 2026"
			year={2026}
			levels={2}
			data={mergeActivity({ github, codex })}
			categories={{ github: { label: "GitHub", tone: "success" }, codex: { label: "Codex", tone: "info" }, both: { label: "Both", tone: "2" } }}
		/>
	</CardContent>
</Card>

Selecting a day

import { ActivityHeatmap } from "@sableui/react"

const [day, setDay] = useState<string | null>(null)

<ActivityHeatmap label="Orders per day" data={{ "2026-10-13": 18, "2026-10-14": 25 }} unit="orders" selectedDate={day} onSelectDate={setDay} />