Skip to main content

HeatmapGrid

A value at every intersection of two category axes, on a 5-bucket sequential ramp.

Signature
Density
Viewport
Theme and light/dark are set in the top bar
Live demo
Open ↗

When to use​

A value at every intersection of two category axes, on a 5-bucket sequential ramp.

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/heatmap-grid
import { HeatmapGrid } from '@/components/prism/HeatmapGrid';

In a no-build prototype, read it from the bundle instead: const { HeatmapGrid } = window.PrismDesignSystem_39d121;

Props​

PropTypeRequiredDescription
xLabelsstring[]Yes
yLabelsstring[]Yes
values(number | null)[][]Yesvalues[row][col], row-major, matching yLabels × xLabels. null = no data.
scale"sequential" | "diverging"—"sequential" for magnitude, "diverging" for deviation from a midpoint.
minnumber—Scale floor / ceiling. Omit to derive from the data. Set explicitly to compare two heatmaps.
maxnumber—
showValuesboolean—Print the number in each cell. Only legible at ~40px cells and up.
formatValue(value: number) => React.ReactNode—
cellHeightnumber—
showLegendboolean—
captionstring—
classNamestring—