- Add the registry
- Add heatmap
Usage
Give data a count for each day that has one, by ISO date, and endDate the last day to show,
usually today. Take today from your data or the server rather than reading the clock while
rendering, since the server's date and the reader's can differ. The heatmap reads every date as UTC, so a day never shifts into the next for
readers in other time zones. Each day takes one of five shades, split at quarters of the busiest day
unless thresholds sets them.
formatCount words a count for the tooltip, the total and screen readers, and locale formats
the dates. Together they put the heatmap in another language, along with label, the legend's
less and more, and a function for HeatmapTotal.
The squares grow to fill the width, up to 12 pixels. Where there's no room for them at 9, the heatmap scrolls, opening on the latest week. Point at a day, or focus the heatmap and move with the arrow keys, to see its count. Page Up and Page Down move four weeks, and Home and End go along the row.
Composition
Examples
Colors
color takes any CSS color for the busiest days, and the lighter shades mix it into the empty one.
Weeks
weeks sets how many to show and weekStartsOn={1} starts them on Monday. Pass HeatmapTotal
a function to word the total yourself.
Selected day
Set selected and onSelectedChange to pick a day by clicking it, or with Enter or Space. Picking it
again clears it.
September 15, 2026: 19 deploys
Props
Heatmap
HeatmapTotal
HeatmapLegend
The children of Heatmap go in a row below the days, lined up with them.