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 barWhen 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
| Prop | Type | Required | Description |
|---|---|---|---|
xLabels | string[] | Yes | |
yLabels | string[] | Yes | |
values | (number | null)[][] | Yes | values[row][col], row-major, matching yLabels × xLabels. null = no data. |
scale | "sequential" | "diverging" | — | "sequential" for magnitude, "diverging" for deviation from a midpoint. |
min | number | — | Scale floor / ceiling. Omit to derive from the data. Set explicitly to compare two heatmaps. |
max | number | — | |
showValues | boolean | — | Print the number in each cell. Only legible at ~40px cells and up. |
formatValue | (value: number) => React.ReactNode | — | |
cellHeight | number | — | |
showLegend | boolean | — | |
caption | string | — | |
className | string | — |