CalendarHeatmap
Place regimes, events and calendars on one time axis a reader can inspect.
@luc/ui/chartsWhat it shows
Place daily observations on a calendar so inactivity, clustering and period effects are visible.
Live preview
Ten sessions of one year, in basis points; the calendar is the axis, not a data field.
<CalendarHeatmap
year={2026}
data={[
["2026-01-06", 12],
["2026-02-11", -8],
["2026-03-17", 24],
["2026-04-22", -3],
["2026-05-28", 17],
["2026-06-09", 41],
["2026-07-15", -19],
["2026-08-20", 7],
["2026-09-24", 33],
["2026-10-01", -11],
]}
format={{ kind: "number", decimals: 0, suffix: " bps" }}
height={300}
ariaLabel="Daily contribution"
/>Controls
Height
A chart measures its container, so it always needs a definite height.
State
The surface the chart is in — loading, empty and error are drawn by the component.
Accessible name
A drawing is not readable by a screen reader, so it needs a name that states what it shows.
The same fixture as the live preview above; the controls change how it is drawn, not what it measures.
Code
import { CalendarHeatmap } from "@luc/ui/charts";
<CalendarHeatmap
year={2026}
data={[
["2026-01-06", 12],
["2026-02-11", -8],
["2026-03-17", 24],
["2026-04-22", -3],
["2026-05-28", 17],
["2026-06-09", 41],
["2026-07-15", -19],
["2026-08-20", 7],
["2026-09-24", 33],
["2026-10-01", -11],
]}
format={{ kind: "number", decimals: 0, suffix: " bps" }}
height={300}
ariaLabel="Daily contribution"
state="ready"
/>Not controllable here
series / rows— The numbers are the caller's; the fixture above is the example.
Copy for an AI agentA specification an agent can act on: the import, the setup, the chosen props, the data contract and the accessibility expectation.
Implement `CalendarHeatmap` from Luc UI. It is: Place regimes, events and calendars on one time axis a reader can inspect.
Import it with: import { CalendarHeatmap } from "@luc/ui/charts";
Requires: react ^19.0.0; react-dom ^19.0.0; react-hook-form ^7.0.0 (optional, for @luc/ui/forms/react-hook-form); tailwindcss ^4.0.0; node >= 22 (repository tools). Import the stylesheet once at the app root and wrap the tree in `LucProvider`. Both come from the package that publishes @luc.
Chosen configuration: `height={300}`, `state="ready"`, `ariaLabel="Daily contribution"`.
Accessibility: keep the component's own semantics. Do not re-implement its ARIA wiring, do not add roles it does not declare, and make sure every interactive element is reachable and operable from the keyboard with a visible focus state.
Styling: use Luc UI design tokens and the component's own props. Do not restyle with raw colour literals and do not override the component's internal structure with page CSS.
Motion: respect `prefers-reduced-motion`. The component already does, so do not disable it.
Reproduce this state:
```tsx
<CalendarHeatmap
year={2026}
data={[
["2026-01-06", 12],
["2026-02-11", -8],
["2026-03-17", 24],
["2026-04-22", -3],
["2026-05-28", 17],
["2026-06-09", 41],
["2026-07-15", -19],
["2026-08-20", 7],
["2026-09-24", 33],
["2026-10-01", -11],
]}
format={{ kind: "number", decimals: 0, suffix: " bps" }}
height={300}
ariaLabel="Daily contribution"
state="ready"
/>
```Usage
The values are prepared by the caller: this component draws the points it is given and computes no statistic of its own, so units, scaling and any summary have to be settled before the data reaches it.
It is drawn by the ECharts engine.
Worked examples with real data are on the family overview: Time series & sequence
import { CalendarHeatmap } from "@luc/ui/charts";<CalendarHeatmap
year={2026}
data={[
["2026-01-06", 12],
["2026-02-11", -8],
["2026-03-17", 24],
["2026-04-22", -3],
["2026-05-28", 17],
["2026-06-09", 41],
["2026-07-15", -19],
["2026-08-20", 7],
["2026-09-24", 33],
["2026-10-01", -11],
]}
format={{ kind: "number", decimals: 0, suffix: " bps" }}
height={300}
ariaLabel="Daily contribution"
/>Data contract
`year` sets the calendar domain; `data` is an array of `[date, value]` pairs with valid calendar dates. Missing dates remain absent rather than becoming zero.
Important configuration
Use `format` for the value unit, keep one year per chart, and explain whether the colour midpoint is zero or a target.
Guidelines
When not to use
Do not treat an absent date as a zero observation or compare calendars drawn with different value domains.
Configuration
| Export | Kind | Signature |
|---|---|---|
CalendarHeatmap | 14 documented props | ({ year, data, format, tone, title, description, state, height, className, ariaLabel, ariaDescription, onReady, onEvent, eager, }: CalendarHeatmapProps) => import("@types/react").JSX.Element |
CalendarHeatmap props
Type: CalendarHeatmapProps
Values the compiler reads from the declaration.
| Prop | Type | Default | Notes |
|---|---|---|---|
ariaDescription? | string | undefined | — | |
ariaLabel? | string | undefined | — | |
className? | string | undefined | — | |
data | readonly (readonly [string, number])[] | — | `[YYYY-MM-DD, value]` pairs. The x axis is the calendar, not a data field. |
description? | string | undefined | — | |
eager? | boolean | undefined | — | Create the engine on mount rather than when the surface is approached. |
format? | ChartFormat | undefined | — | |
height? | string | number | undefined | — | |
onEvent? | ((event: EChartEvent) => void) | undefined | — | |
onReady? | ((chart: EChartsInstance) => void) | undefined | — | |
state? | ChartState | undefined | — | |
title? | string | undefined | — | |
tone? | SeriesTone | undefined | — | |
year | number | — |
Accessibility
A chart is a picture of data, so it needs a name that states what it shows, and the numbers must exist as text somewhere on the page — in a table or a written summary — because a drawing is not readable by a screen reader and cannot be copied.
What happens on the server, and when hydration changes it.
Family
Time series & sequence
Regimes, events and calendars over a shared inspection cursor.
Related