CalendarHeatmap
One cell per day, weeks as columns, weekdays as rows. Accent-scaled steps, keyboard navigation with a tooltip, and a contained screen-reader summary; a long range scrolls inside its own box, opening on the most recent weeks.
Signature
Density
Viewport
Theme and light/dark are set in the top barWhen to use
One cell per day, weeks as columns, weekdays as rows.
Accessibility
Each chart ships an accessible fallback (a visually-hidden data table / aria-label summary) so the data is available to screen readers, not just sighted users. Colour is paired with shape/label, never used alone.
Install and import
npx shadcn@latest add @prism/calendar-heatmap
import { CalendarHeatmap } from '@/components/prism/CalendarHeatmap';
In a no-build prototype, read it from the bundle instead: const { CalendarHeatmap } = window.PrismDesignSystem_39d121;
Props
| Prop | Type | Required | Description |
|---|---|---|---|
data | CalendarDay[] | Yes | |
from | DateInput | — | First day shown. Default: the first dated entry. |
to | DateInput | — | Last day shown. Default: the last dated entry. |
start | DateInput | — | @deprecated Alias of from. |
end | DateInput | — | @deprecated Alias of to. |
today | string | — | Today, "YYYY-MM-DD". Days after it are drawn empty and skipped by the keyboard. Pass it from a Server Component so server and browser agree; without it, today is worked out after the page loads, in timeZone. |
timeZone | string | — | The school's IANA timezone (e.g. "Asia/Kolkata") for working out today. Default: the browser's. |
locale | string | — | Locale for dates, month and weekday labels, and numbers. Default "en-GB" (fixed, so server and browser match). |
scale | "sequential" | "diverging" | — | "sequential" (default): zero + four steps toward the accent. "diverging": five --chart-div steps around a midpoint. |
min | number | — | Scale floor. Default 0. |
max | number | — | Scale ceiling. Default: the largest value in range. |
hue | CategoricalHue | — | Colour the steps with a categorical hue instead of the accent. |
unit | string | [string, string] | — | Names each day's amount: "applications", or ["application", "applications"] for singular/plural. "8 October 2026: 8 applications". |
formatValue | (value: number) => string | number | — | Formats an amount when unit isn't enough; must return text (it becomes the cell's name). |
cellSize | number | — | Cell edge in px. Default 13. |
showLegend | boolean | — | |
legendLabels | [string, string] | — | The legend's two ends. Default ["Less", "More"]. |
caption | string | — | Names the grid for screen readers. |
onSelect | (date: string) => void | — | Makes days selectable (Enter, Space or click); receives "YYYY-MM-DD". |
selected | string | null | — | Controlled selected day, "YYYY-MM-DD" (null for none). |
defaultSelected | string | — | Initially selected day when uncontrolled. |
className | string | — |