Heatmap
Cells in five dithered steps, as a matrix or a calendar. Arrows walk the grid; the scale is in numbers.
import { Heatmap, dashboardHeatLevel, dashboardCalendarCells } from "@forgeron/ui";Sales
Support
Ops
Finance
Arrow keys move between cells; Home and End jump to the ends of a row.
020
import { Heatmap } from "@forgeron/ui";
const values = [
[4, 9, 12, 7, 3, 0, 0],
[1, 3, 5, 8, 6, 1, 0],
[10, 14, 20, 17, 12, 2, 1],
[0, 2, 3, 2, 1, 0, 0],
];
export default function Matrix() {
return (
<Heatmap
title="Activity by team"
rows={["Sales", "Support", "Ops", "Finance"]}
columns={["Mon", "Tue", "Wed", "Thu", "Fri", "Sat", "Sun"]}
values={values}
cell={22}
unit="activities"
highlight="Ops"
/>
);
}Mon
Wed
Fri
Sun
Arrow keys move between cells; Home and End jump to the ends of a row.
09
import { Heatmap } from "@forgeron/ui";
/** A day `offset` days from 2026-11-18, as YYYY-MM-DD. */
const day = (offset: number) => {
const d = new Date(2026, 10, 18 + offset);
return `${d.getFullYear()}-${String(d.getMonth() + 1).padStart(2, "0")}-${String(d.getDate()).padStart(2, "0")}`;
};
export default function Calendar() {
return (
<Heatmap
title="Commits, last 20 weeks"
from={day(-139)}
to={day(0)}
items={Array.from({ length: 140 }, (_, i) => ({
date: day(i - 139),
value: Math.max(0, Math.round(Math.sin(i / 3) * 5 + ((i * 7) % 6) - 1)),
}))}
cell={12}
unit="commits"
/>
);
}API → Props
| Prop | Type | Default | Description |
|---|---|---|---|
title | string | — | Names the chart; also its caption. |
rows / columns / values | string[] / string[] / number[][] | — | A matrix: values[row][column]. |
items / from / to | { date, value }[] / string / string | — | A calendar: one value per day (YYYY-MM-DD) of the period. |
weekStart | "mon" | "sun" | "mon" | The first row of a calendar. |
format | (value: number) => string | String | Writes a value. |
highlight | string | — | Matrix: the row to stand out. Calendar: a day, YYYY-MM-DD. |
unit | string | — | What a value counts, in the readout. |
cell | number | 14 | Side of a cell, in px. |
className | string | — | Extra classes. |