# Heatmap: when the work happens, by weekday and hour

Heatmap draws values on a grid, such as weekdays by hours or weekdays by weeks, in six steps of one hue, with empty cells in quiet grey and a scale from less to more under it. Every cell is reachable with the arrow keys and shows its value, and a table carries them all for screen readers.

Checked 2 December 2026. By Bohuslav Poláček. https://meadowstack.com/components/heatmap/

*Two heatmaps from the demo on Wednesday 2 December 2026: Ridgeway Freight's loadings by weekday and hour over the last seven days, and Martin Kerr's minutes of training on each weekday over the last 12 weeks.*

A live screen, rendered from the kit's components on the page: https://meadowstack.com/components/heatmap/

## What it is for, and what the preview shows

Intensity over a week: when the loading bays are busiest, which days someone trains, when the phones ring. The preview holds two heatmaps from the demo, rebuilt from the kit with its numbers. On the left, [Ridgeway Freight](https://meadowstack.com/examples/haulage-dispatch-planning/)'s loadings by weekday and hour from 5:00 to 21:00 over the last seven days: the deepest cells sit from 6:00 to 9:00 on weekdays, Saturday stays light, and Sunday has one loading an hour from 6:00 to 9:00 and none after. On the right, the minutes [Martin Kerr](https://meadowstack.com/examples/personal-app-for-a-creator/) trained on each weekday over the last 12 weeks, the weeks labelled by their Monday: Tuesday has training in all 12, and the days without any are the quiet grey of an empty cell, as are this week's days from today on.

Both label every second column, as the demo asks with `columnLabelEvery`, so the labels stay readable when the cells are narrow.

## The rules, and where they live

- **The manifest**: use it for activity by weekday and hour, or a year of days; not for exact values (`DataTable`). It replaces "a hand-built grid of coloured cells".
- **docs/patterns.md, Data**: colour by job: magnitude is one sequential hue in steps (`seq-1…6`), identity the `chart-1…8` slots, state the status colours; intensity by day and hour is the `Heatmap`, with Ridgeway's reports as the example.
- **docs/principles.md, Charts**: one measure is one hue of the sequential scale; every chart has a table for screen readers and works with the arrow keys.
- **AGENTS.md, Charts**: charts in cards fill them (`ChartCard`) and load as `ChartSkeleton`.
- **AGENTS.md, Tokens only**: colours come from the kit's OKLCH generator in light and dark; a hex, rgb or oklch value typed into a component fails `npm run check:tokens`.

## What AI coding tools write instead

A hand-built grid of coloured cells, as the manifest's `replaces` names it. What goes wrong:

- The colour is one brand colour with its opacity set by the value, so a cell's colour depends on what lies behind it and the faint cells vanish in dark mode. The kit uses six fixed steps of one hue from its tokens, made for light and dark.
- A zero gets the faintest colour, so nothing and a little look alike. The kit draws a cell with nothing in it in the page's quiet grey.
- Without a scale nobody knows what the deepest cell means. The kit's scale under the grid runs from less to more, and every cell shows its value on hover or focus.
- In a wide card the cells stretch into slabs. The kit's cells are at most 28px wide, so they stay near square.
- The grid is a set of coloured boxes and nothing else, so a screen reader gets nothing. The kit's cells are reachable with the arrow keys, and a table carries every value.

## How to use it

- `rows` and `columns`: the labels, top to bottom and left to right, such as weekdays and hours or weekdays and weeks.
- `values`: `values[row][column]`; zero or less is an empty cell.
- `formatValue`: how a value reads in the tooltip and the table, such as "75 min", or "no training" for a zero.
- `columnLabelEvery`: print every second or third column label, for hours.
- `title` and `description`; put it in a `ChartCard` beside the other charts.

## Its entry in the manifest

*The component's rules as the kit's manifest states them, the same entry an AI coding tool reads.*

| Manifest field | Heatmap |
| --- | --- |
| What it is | Values on a grid of days or hours in the steps of one hue. |
| Use it for | Activity by weekday and hour, or a year of days. |
| Not for | For exact values (DataTable) |
| It replaces | A hand-built grid of coloured cells |
| Screen types | Overview |
| Import | `import { Heatmap } from "@meadowstack-studio/kit";` |

Read from the kit's component manifest when the site was built (126 components, packages/kit/src/components.json); the same entry answers an AI coding tool through the kit's MCP server.

## Where it runs in the example apps

*The example apps whose code renders a Heatmap, and the modules it sits in.*

| Example app | Modules that render it |
| --- | --- |
| [An app for a haulage company](https://meadowstack.com/examples/haulage-dispatch-planning/) | Reports |
| [An app for a sports club](https://meadowstack.com/examples/sports-club-court-bookings/) | Club |
| [An app for one person](https://meadowstack.com/examples/personal-app-for-a-creator/) | Training |

Read from the demo's source when the site was built: 3 of 9 example apps render <Heatmap>, in the modules named here as each app's sidebar names them.

## How the demo calls it

*Martin Kerr's training days: weekdays as rows, the last 12 weeks as columns labelled by their Monday, minutes in the cells, a day without training named as such.*

From `apps/demo/src/modules/fitness/pages/progress.tsx` in the Meadowstack repository:

```tsx
<Heatmap
  title={tx("Dny s tréninkem", "Training days")}
  description={tx(
    "Minuty tréninku na jednotlivé dny, posledních 12 týdnů.",
    "Minutes of training on each day, over the last 12 weeks.",
  )}
  rows={[...weekdayShort]}
  columns={weeks.map((week) => formatDay(week.start).replace(" ", "\u00a0"))}
  values={weekdayShort.map((_, row) => weeks.map((week) => week.minutes[row] ?? 0))}
  formatValue={(value) => (value ? `${value} min` : tx("bez tréninku", "no training"))}
  columnLabelEvery={2}
/>
```

## Questions

### What can a heatmap show besides hours?

Any two dimensions with a count or an amount in each cell: weekdays by weeks, as Martin Kerr's training does, or a year of days. For exact values a table is the better choice.

### How are the colours chosen?

From one hue of the kit's sequential scale, in six steps, with the same tokens in light and dark mode. Empty cells are the page's quiet grey, and a scale under the grid runs from less to more.

### Is it accessible?

Every cell is reachable with the arrow keys and shows its value in a tooltip, and a table carries all the values for screen readers. The values follow formatValue, so a zero can read as no training rather than as a bare number.

### Why not a column chart?

A column chart shows one count per period. A heatmap shows a count for every pair, every hour of every weekday, so the pattern across the week shows at a glance where seven column charts would not.

## Related

- [BarList: a ranking you read from the top](https://meadowstack.com/components/bar-list/) (Components)
- [StatGroup: the key figures at the top of an overview](https://meadowstack.com/components/stat-group/) (Components)
- [A fleet cost report that ranks every truck](https://meadowstack.com/screens/fleet-costs/) (Screens)
- [GanttChart: a project schedule with its links and key dates](https://meadowstack.com/components/gantt-chart/) (Components)
- [Notice: messages by importance, in one frame](https://meadowstack.com/components/notice/) (Components)
- [ResourceTimeline: bookings across resources, hour by hour](https://meadowstack.com/components/resource-timeline/) (Components)
