Activity Heatmap
A GitHub-style contribution calendar that shades one cell per day by how much happened that day.
<arc-activity-heatmap>Overview
Activity Heatmap draws a contribution calendar: 52 week columns, one cell per day, tinted deeper as the day gets busier. Month labels run along the top, Mon, Wed and Fri labels down the side, and a Less to More legend sits underneath. Hovering a cell, or focusing the grid and using the arrow keys, raises it with the glow and shows the date and the day's label or value in a small bubble.
The data property takes one entry per day with activity: an ISO date, a numeric value, and an optional label that replaces the bare number in the detail ("7 commits" instead of "7"). Days without an entry render as empty cells, so you don't need to fill in zeros. By default the grid ends today and runs back weeks columns (52). Set end-date to show a fixed window. When end-date is unset, the server render and the first client render anchor on the newest date in the data, and the browser switches to today one render later. Set end-date when server and client must match exactly.
Intensity is relative by default. The nonzero values are split into quartiles, one per step of the ramp, so a quiet repository and a busy one both use the full range. Set max to get a linear scale from zero to that value instead. Empty days use --surface-overlay, and the four active steps are --accent-primary-rgb at rising alpha, so overriding that one token recolors every step but the empty one.
Screen readers get the grid as one image with a summary label (day count, end date, total and active days), not 364 tab stops. The grid takes focus once: up and down move a day, left and right move a week, Home and End jump to the first and last day, and a live region reads out each cell.
Guidelines
Do
- Use it for daily counts over months: commits, deploys, workouts, practice sessions
- Give each entry a label ("7 commits"). The hover detail and the live region read it out
- Set end-date when the window is a fixed report ("2025 in review") or when server and client must render the same grid
- Set max when readers compare two heatmaps or there's a known ceiling. Quartile ramps are relative to each dataset, so side by side they mislead
- Match week-start to your readers: Sunday is the GitHub convention, Monday the ISO one
- Keep the legend unless the page already explains the ramp. It is the only key to the colors
Don't
- Don't use it for a continuous metric like latency or revenue. Use Sparkline
- Don't use it for pass/fail history per period. Use Uptime, which has its own status colors
- Don't use it to show scheduled items on dates. Use Calendar
- Don't put more than one measure in a cell. Two measures need two heatmaps
Features
- Weeks start on Sunday or Monday via `week-start`
- Month and weekday labels come from `Intl`
- Cell size and gap are set by `--activity-heatmap-cell` and `--activity-heatmap-gap`
Preview
Usage
Its events and state need JavaScript, so use the Web Component or a framework wrapper for those.
<script type="module" src="@arclux/arc-ui"></script>
<arc-activity-heatmap id="api-activity" end-date="2026-12-31" weeks="52"></arc-activity-heatmap>
<script>
const map = document.querySelector('#api-activity');
// One entry per day with activity; empty days need no entry.
map.data = [
{ date: '2026-12-29', value: 3, label: '3 commits' },
{ date: '2026-12-30', value: 11, label: '11 commits' },
{ date: '2026-12-31', value: 6, label: '6 commits' },
];
// Quartiles scale the ramp by default; pin max for an absolute scale:
map.max = 12;
</script>import { ActivityHeatmap } from '@arclux/arc-ui-react';
const year = commits.map((day) => ({
date: day.date, // 'YYYY-MM-DD'
value: day.count,
label: `${day.count} commits`,
}));
export function ContributionGraph() {
return <ActivityHeatmap data={year} weeks={52} weekStart="monday" />;
}<script setup>
import { ActivityHeatmap } from '@arclux/arc-ui-vue';
const year = commits.map((day) => ({
date: day.date,
value: day.count,
label: `${day.count} commits`,
}));
</script>
<template>
<ActivityHeatmap :data="year" :weeks="52" week-start="monday" />
</template><script>
import { ActivityHeatmap } from '@arclux/arc-ui-svelte';
const year = commits.map((day) => ({
date: day.date,
value: day.count,
label: `${day.count} commits`,
}));
</script>
<ActivityHeatmap data={year} weeks={52} weekStart="monday" />import { Component } from '@angular/core';
import { ActivityHeatmap } from '@arclux/arc-ui-angular';
@Component({
imports: [ActivityHeatmap],
template: `
<arc-activity-heatmap [data]="year" weeks="52" week-start="monday" />
`,
})
export class ContributionGraphComponent {
year = commits.map((day) => ({
date: day.date,
value: day.count,
label: `${day.count} commits`,
}));
}import { ActivityHeatmap } from '@arclux/arc-ui-solid';
const year = commits.map((day) => ({
date: day.date,
value: day.count,
label: `${day.count} commits`,
}));
export function ContributionGraph() {
return <ActivityHeatmap data={year} weeks={52} weekStart="monday" />;
}import { ActivityHeatmap } from '@arclux/arc-ui-preact';
const year = commits.map((day) => ({
date: day.date,
value: day.count,
label: `${day.count} commits`,
}));
export function ContributionGraph() {
return <ActivityHeatmap data={year} weeks={52} weekStart="monday" />;
}API
end-datestring''- The newest day shown, as an ISO string (YYYY-MM-DD). Unset: today in the browser; on the server, the newest date in
data(see above). weeksnumber52- How many week columns to render, counting back from the week containing the end date (default 52), at least 1. The last column is truncated after the end date, so the newest cell is always the end date itself.
weekStart'sunday' | 'monday''sunday'- Which day starts each column: "sunday" (default, the GitHub convention) or "monday". An unrecognised value falls back to sunday.
legendbooleantrue- Whether to render the Less→More swatch strip under the grid. Default true; disable from markup with either
no-legendorlegend="false". dataArray<{date: string, value: number, label?: string}>[]- One entry per day with activity: an ISO
date(YYYY-MM-DD), a numericvaluemapped to the intensity ramp, and an optionallabelshown in the hover detail in place of the bare value (e.g. "7 commits"). Days in the rendered span with no entry render as empty cells, so sparse data is fine. Set it from script, a framework binding, or a JSON attribute. maxnumber0- When set, intensity is a linear scale from 0 to this value instead of the default quartile mapping: each nonzero value lands on step 1-4 by
value / max. Values at or abovemaxrender as step 4.
See also
- UptimeA status-page strip of slim ticks, one per period, each colored by how that period went.
- SparklineA small inline line or bar chart, drawn as SVG from a comma-separated string of numbers.
- CalendarA month of days in a grid, for picking one date.
- ChartLine, area, bar and donut charts drawn in SVG from a plain array of series, with no charting library.