Skip to main content

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 bar
Live demo
Open ↗

When 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​

PropTypeRequiredDescription
dataCalendarDay[]Yes
fromDateInput—First day shown. Default: the first dated entry.
toDateInput—Last day shown. Default: the last dated entry.
startDateInput—@deprecated Alias of from.
endDateInput—@deprecated Alias of to.
todaystring—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.
timeZonestring—The school's IANA timezone (e.g. "Asia/Kolkata") for working out today. Default: the browser's.
localestring—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.
minnumber—Scale floor. Default 0.
maxnumber—Scale ceiling. Default: the largest value in range.
hueCategoricalHue—Colour the steps with a categorical hue instead of the accent.
unitstring | [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).
cellSizenumber—Cell edge in px. Default 13.
showLegendboolean—
legendLabels[string, string]—The legend's two ends. Default ["Less", "More"].
captionstring—Names the grid for screen readers.
onSelect(date: string) => void—Makes days selectable (Enter, Space or click); receives "YYYY-MM-DD".
selectedstring | null—Controlled selected day, "YYYY-MM-DD" (null for none).
defaultSelectedstring—Initially selected day when uncontrolled.
classNamestring—