Skip to content
WunderUI

Heatmap

Pro

Heatmap for values across two dimensions: a weekday × hour matrix, a contribution calendar, a punch card, labelled cells and a correlation matrix.

Playground

Sessions by hour

Sessions by weekday and hour, 7 rows × 24 columns, values from 0 to 87.
Sessions by weekday and hour, data table
Row · columnValue
Mon · 0:006
Mon · 1:002
Mon · 2:008
Mon · 3:004
Mon · 4:004
Mon · 5:006
Mon · 6:0010
Mon · 7:0020
Mon · 8:0027
Mon · 9:0043
Mon · 10:0050
Mon · 11:0066
Mon · 12:0078
Mon · 13:0080
Mon · 14:0087
Mon · 15:0082
Mon · 16:0072
Mon · 17:0066
Mon · 18:0048
Mon · 19:0035
Mon · 20:0032
Mon · 21:0016
Mon · 22:0016
Mon · 23:0011
Tue · 0:004
Tue · 1:001
Tue · 2:006
Tue · 3:004
Tue · 4:0010
Tue · 5:0012
Tue · 6:0014
Tue · 7:0016
Tue · 8:0027
Tue · 9:0039
Tue · 10:0050
Tue · 11:0067
Tue · 12:0075
Tue · 13:0083
Tue · 14:0082
Tue · 15:0085
Tue · 16:0072
Tue · 17:0064
Tue · 18:0055
Tue · 19:0042
Tue · 20:0033
Tue · 21:0018
Tue · 22:0015
Tue · 23:0011
Wed · 0:007
Wed · 1:005
Wed · 2:008
Wed · 3:007
Wed · 4:0010
Wed · 5:0011
Wed · 6:0011
Wed · 7:0022
Wed · 8:0031
Wed · 9:0039
Wed · 10:0052
Wed · 11:0061
Wed · 12:0074
Wed · 13:0078
Wed · 14:0087
Wed · 15:0081
Wed · 16:0075
Wed · 17:0063
Wed · 18:0054
Wed · 19:0040
Wed · 20:0025
Wed · 21:0024
Wed · 22:0012
Wed · 23:008
Thu · 0:006
Thu · 1:001
Thu · 2:003
Thu · 3:004
Thu · 4:003
Thu · 5:0014
Thu · 6:0018
Thu · 7:0020
Thu · 8:0030
Thu · 9:0041
Thu · 10:0051
Thu · 11:0062
Thu · 12:0072
Thu · 13:0085
Thu · 14:0086
Thu · 15:0083
Thu · 16:0078
Thu · 17:0068
Thu · 18:0048
Thu · 19:0035
Thu · 20:0032
Thu · 21:0016
Thu · 22:0015
Thu · 23:0013
Fri · 0:006
Fri · 1:002
Fri · 2:005
Fri · 3:004
Fri · 4:005
Fri · 5:008
Fri · 6:0016
Fri · 7:0019
Fri · 8:0029
Fri · 9:0041
Fri · 10:0051
Fri · 11:0061
Fri · 12:0077
Fri · 13:0082
Fri · 14:0082
Fri · 15:0080
Fri · 16:0071
Fri · 17:0066
Fri · 18:0052
Fri · 19:0038
Fri · 20:0028
Fri · 21:0017
Fri · 22:0012
Fri · 23:0011
Sat · 0:000
Sat · 1:007
Sat · 2:005
Sat · 3:009
Sat · 4:007
Sat · 5:009
Sat · 6:007
Sat · 7:009
Sat · 8:0012
Sat · 9:0016
Sat · 10:0024
Sat · 11:0027
Sat · 12:0037
Sat · 13:0031
Sat · 14:0034
Sat · 15:0038
Sat · 16:0031
Sat · 17:0030
Sat · 18:0024
Sat · 19:0022
Sat · 20:0015
Sat · 21:008
Sat · 22:0013
Sat · 23:004
Sun · 0:007
Sun · 1:005
Sun · 2:004
Sun · 3:003
Sun · 4:006
Sun · 5:006
Sun · 6:0012
Sun · 7:0013
Sun · 8:0015
Sun · 9:0020
Sun · 10:0025
Sun · 11:0027
Sun · 12:0034
Sun · 13:0039
Sun · 14:0037
Sun · 15:0032
Sun · 16:0031
Sun · 17:0026
Sun · 18:0027
Sun · 19:0017
Sun · 20:0018
Sun · 21:0011
Sun · 22:008
Sun · 23:0010

Installation

Heatmap comes with WunderUI Core and Pro, in the package from your plan. See the plans.

The charts live in their own entry point: import the chart, its card and its hooks from @wunderui/react/charts, not from @wunderui/react.

Then import what you need:

tsx
import {
  HeatmapChart,
  HeatmapChartProps,
  HeatmapChartVariant,
} from "@wunderui/react/charts"

Then use it:

tsx
import { HeatmapChart } from "@wunderui/react/charts"

const matrix = [
  [4, 12, 30, 18],
  [6, 15, 34, 20],
  [2, 5, 9, 4],
]

export function TicketsByHour() {
  return (
    <HeatmapChart
      matrix={matrix}
      rowLabels={["Mon", "Tue", "Sat"]}
      columnLabels={["6:00", "12:00", "18:00", "24:00"]}
      label="Tickets by weekday and hour"
    />
  )
}

Expected result: You see a grid of three rows and four columns, darker where the value is higher.

When to use

Use Heatmap for

  • A value for each row and column: weekday by hour, a contribution calendar
  • A correlation matrix on a diverging scale
  • A punch card, where the size of a circle replaces colour

Use something else for

States

Loading, empty and error keep the chart's size, so the card never jumps. Add a retry handler and the error state offers a Try again button.

Sessions by hour

Sessions by weekday and hour, 7 rows × 24 columns, values from 0 to 87.
Sessions by weekday and hour, data table
Row · columnValue
Mon · 0:006
Mon · 1:002
Mon · 2:008
Mon · 3:004
Mon · 4:004
Mon · 5:006
Mon · 6:0010
Mon · 7:0020
Mon · 8:0027
Mon · 9:0043
Mon · 10:0050
Mon · 11:0066
Mon · 12:0078
Mon · 13:0080
Mon · 14:0087
Mon · 15:0082
Mon · 16:0072
Mon · 17:0066
Mon · 18:0048
Mon · 19:0035
Mon · 20:0032
Mon · 21:0016
Mon · 22:0016
Mon · 23:0011
Tue · 0:004
Tue · 1:001
Tue · 2:006
Tue · 3:004
Tue · 4:0010
Tue · 5:0012
Tue · 6:0014
Tue · 7:0016
Tue · 8:0027
Tue · 9:0039
Tue · 10:0050
Tue · 11:0067
Tue · 12:0075
Tue · 13:0083
Tue · 14:0082
Tue · 15:0085
Tue · 16:0072
Tue · 17:0064
Tue · 18:0055
Tue · 19:0042
Tue · 20:0033
Tue · 21:0018
Tue · 22:0015
Tue · 23:0011
Wed · 0:007
Wed · 1:005
Wed · 2:008
Wed · 3:007
Wed · 4:0010
Wed · 5:0011
Wed · 6:0011
Wed · 7:0022
Wed · 8:0031
Wed · 9:0039
Wed · 10:0052
Wed · 11:0061
Wed · 12:0074
Wed · 13:0078
Wed · 14:0087
Wed · 15:0081
Wed · 16:0075
Wed · 17:0063
Wed · 18:0054
Wed · 19:0040
Wed · 20:0025
Wed · 21:0024
Wed · 22:0012
Wed · 23:008
Thu · 0:006
Thu · 1:001
Thu · 2:003
Thu · 3:004
Thu · 4:003
Thu · 5:0014
Thu · 6:0018
Thu · 7:0020
Thu · 8:0030
Thu · 9:0041
Thu · 10:0051
Thu · 11:0062
Thu · 12:0072
Thu · 13:0085
Thu · 14:0086
Thu · 15:0083
Thu · 16:0078
Thu · 17:0068
Thu · 18:0048
Thu · 19:0035
Thu · 20:0032
Thu · 21:0016
Thu · 22:0015
Thu · 23:0013
Fri · 0:006
Fri · 1:002
Fri · 2:005
Fri · 3:004
Fri · 4:005
Fri · 5:008
Fri · 6:0016
Fri · 7:0019
Fri · 8:0029
Fri · 9:0041
Fri · 10:0051
Fri · 11:0061
Fri · 12:0077
Fri · 13:0082
Fri · 14:0082
Fri · 15:0080
Fri · 16:0071
Fri · 17:0066
Fri · 18:0052
Fri · 19:0038
Fri · 20:0028
Fri · 21:0017
Fri · 22:0012
Fri · 23:0011
Sat · 0:000
Sat · 1:007
Sat · 2:005
Sat · 3:009
Sat · 4:007
Sat · 5:009
Sat · 6:007
Sat · 7:009
Sat · 8:0012
Sat · 9:0016
Sat · 10:0024
Sat · 11:0027
Sat · 12:0037
Sat · 13:0031
Sat · 14:0034
Sat · 15:0038
Sat · 16:0031
Sat · 17:0030
Sat · 18:0024
Sat · 19:0022
Sat · 20:0015
Sat · 21:008
Sat · 22:0013
Sat · 23:004
Sun · 0:007
Sun · 1:005
Sun · 2:004
Sun · 3:003
Sun · 4:006
Sun · 5:006
Sun · 6:0012
Sun · 7:0013
Sun · 8:0015
Sun · 9:0020
Sun · 10:0025
Sun · 11:0027
Sun · 12:0034
Sun · 13:0039
Sun · 14:0037
Sun · 15:0032
Sun · 16:0031
Sun · 17:0026
Sun · 18:0027
Sun · 19:0017
Sun · 20:0018
Sun · 21:0011
Sun · 22:008
Sun · 23:0010

Colour scale

Shade paints one colour at a strength that follows the value. Indigo steps paint five tones of one hue, indigo 200 for the quietest cells to 600 for the busiest, and pick white or near-black text per step. The legend under the grid shows the same steps and its two ends are yours to name (scaleLabels). Cells arrive as a column wave; hover a cell and the others step back. The arrow keys walk the grid, ↑ ↓ between rows.

Support tickets

Tickets by weekday and hour, 7 rows × 8 columns, values from 0 to 75.
Tickets by weekday and hour, data table
Row · columnValue
Mon · 0:001
Mon · 3:009
Mon · 6:0026
Mon · 9:0045
Mon · 12:0070
Mon · 15:0073
Mon · 18:0045
Mon · 21:0023
Tue · 0:008
Tue · 3:007
Tue · 6:0024
Tue · 9:0052
Tue · 12:0068
Tue · 15:0071
Tue · 18:0052
Tue · 21:0021
Wed · 0:006
Wed · 3:0014
Wed · 6:0022
Wed · 9:0050
Wed · 12:0075
Wed · 15:0069
Wed · 18:0050
Wed · 21:0028
Thu · 0:004
Thu · 3:0012
Thu · 6:0020
Thu · 9:0048
Thu · 12:0073
Thu · 15:0067
Thu · 18:0048
Thu · 21:0026
Fri · 0:002
Fri · 3:0010
Fri · 6:0027
Fri · 9:0046
Fri · 12:0071
Fri · 15:0074
Fri · 18:0046
Fri · 21:0024
Sat · 0:008
Sat · 3:004
Sat · 6:0012
Sat · 9:0024
Sat · 12:0025
Sat · 15:0028
Sat · 18:0024
Sat · 21:009
Sun · 0:006
Sun · 3:002
Sun · 6:0010
Sun · 9:0022
Sun · 12:0023
Sun · 15:0026
Sun · 18:0022
Sun · 21:007

Keyboard interactions

The plot is focusable and the arrow keys walk the grid: left and right in a row, up and down between rows. The live region reads row, column and value (like Mon, 9am: 12), or no value for an empty cell.

TaborShiftTab
Moves focus to the plot and away from it. The plot is one tab stop; so is every legend badge.
ArrowRightorArrowLeft
Moves to the next or previous cell in the row. The tooltip follows, and a live region announces the one you are on. The first press starts at the first cell (Left: the last one).
ArrowDownorArrowUp
Moves to the cell below or above in the same column; a shorter row takes its nearest cell.
HomeorEnd
Jumps to the first or last cell of the row. With Ctrl (Cmd on a Mac): to the first or last cell of the grid.
Escape
Clears the active point.
EnterorSpace
On a legend badge of a ChartCard: switches its series off or on. The last visible series stays on.

Behavior and motion

What the chart does on its own and what the page decides.

Matrix
The matrix is a list of rows of values, with null for no data. Row and column labels name them, and the column tick setting thins the labels when there are many.
Colour
Tint grows with value, and a null cell uses the muted colour, not a low value. The correlation matrix uses a diverging scale: blue for positive, red for negative.
Cell values
The labelled heatmap and correlation matrix write the value in each cell, in a text colour that keeps contrast. When cells are too small, only the hovered or focused one shows its value.
Scale legend
A Less to More strip sits under the grid, and you can hide it or add a caption such as 2,384 contributions in 2026.
Loading, empty and error
The chart keeps its size while loading, empty or failed, so the card never changes height. Add a retry handler to show a Try again button on error.
Size
The chart fills the width of its container, and you set the plot height. Text never scales: labels keep their size at every width.

Motion

The enter sequence and hover follow the library's motion tokens.

Column wave
Cells settle in column by column from left to right, the whole grid in about 1.1 s, the first time the chart is in view, after loading and when new data arrives. A parent re-render with the same values does not replay it. You can turn it off.
Hover
The hovered or focused cell keeps its strength and the others dim to --chart-dim, with a short opacity transition.
Reduced motion
With reduced motion the enter sequence is off and the chart appears at once. The tooltip, the hover dimming and every state still work.

Anatomy

HeatmapChart shows a value for each row and column as colour: a weekday by hour grid, a contribution calendar, a punch card, labelled cells or a correlation matrix. Pass the grid as a matrix.

Support tickets

Tickets by weekday and hour, 7 rows × 8 columns, values from 0 to 75.
Tickets by weekday and hour, data table
Row · columnValue
Mon · 0:001
Mon · 3:009
Mon · 6:0026
Mon · 9:0045
Mon · 12:0070
Mon · 15:0073
Mon · 18:0045
Mon · 21:0023
Tue · 0:008
Tue · 3:007
Tue · 6:0024
Tue · 9:0052
Tue · 12:0068
Tue · 15:0071
Tue · 18:0052
Tue · 21:0021
Wed · 0:006
Wed · 3:0014
Wed · 6:0022
Wed · 9:0050
Wed · 12:0075
Wed · 15:0069
Wed · 18:0050
Wed · 21:0028
Thu · 0:004
Thu · 3:0012
Thu · 6:0020
Thu · 9:0048
Thu · 12:0073
Thu · 15:0067
Thu · 18:0048
Thu · 21:0026
Fri · 0:002
Fri · 3:0010
Fri · 6:0027
Fri · 9:0046
Fri · 12:0071
Fri · 15:0074
Fri · 18:0046
Fri · 21:0024
Sat · 0:008
Sat · 3:004
Sat · 6:0012
Sat · 9:0024
Sat · 12:0025
Sat · 15:0028
Sat · 18:0024
Sat · 21:009
Sun · 0:006
Sun · 3:002
Sun · 6:0010
Sun · 9:0022
Sun · 12:0023
Sun · 15:0026
Sun · 18:0022
Sun · 21:007
  • Takes a matrix of rows by columns (null for no data) plus row and column labels. Options thin the column labels, set the colour scale or the tonal indigo palette, add a caption and name the two ends of the scale legend.

  • data-slot="chart-plot"

    The focusable region. Arrow keys walk the marks and the live region reads each one as the tooltip shows it.

  • data-slot="chart-marks"

    One rounded cell per value, arriving as a column wave from left to right. Strength grows with value (or one of five indigo steps) and a null cell uses the muted colour, not a low value. The hovered cell keeps its strength while every other cell steps back.

  • data-slot="chart-value-active"Optional

    The number inside each cell on the labelled heatmap and correlation matrix, in a text colour that keeps contrast. When cells are too small, only the hovered or focused cell shows its value.

  • Optional

    The strip under the grid, Less to More by default (scaleLabels renames the ends, -1 to +1 on the correlation matrix, blue positive and red negative), plus a caption such as 2,384 contributions in 2026. Its width follows its labels.

  • data-slot="chart-tooltip"Optional

    Row and column labels as the title, then the cell value.

  • data-slot="chart-message"Optional

    Muted bars as the placeholder under the shimmer. A matrix with no numbers counts as empty, and you can reword the message with a custom title and description.

  • A table of every cell for screen readers.

  • data-slot="chart-scale-legend"Optional

Best practices

  • Do

    Use one hue per measure (indigo by default, green on the calendar) so lightness is the only variable. Use diverging blue and red only for values around zero, like correlations.

  • Do

    Use the labelled heatmap when people need the number, and the punch card when a cell has a count and a rate. Colour alone is a rough read.

  • Do

    Pass null for missing data, not 0. A zero is a measurement and is drawn as the lowest step.

  • Don’t

    Don't compare two heatmaps with different maxima. Each one scales to its own largest value, so the same colour means different numbers.

  • Don’t

    Don't go beyond about 7 by 24 cells without thinning the column labels. Dense labels overlap and the grid stops being readable.

API reference

One table for HeatmapChart, listing every prop. The ChartCard around it takes its own props (title, legend, periods, table and more), and the chart works without one.

Takes a matrix of rows by columns (null for no data) plus row and column labels. Options thin the column labels, set the colour scale or the tonal indigo palette, add a caption and name the two ends of the scale legend.

PropTypeDefaultDescription
matrix requiredreadonly (readonly (number | null)[])[]—Values row by row (rows × columns). = no data. Correlation: −1…1.
rowLabels requiredreadonly string[]—
columnLabels requiredreadonly string[]—Column labels; with only every n-th is shown (calendar months, hours).
variant"matrix-heatmap" | "calendar-heatmap" | "punch-card" | "labelled-heatmap" | "correlation-matrix""matrix-heatmap"Figma variant. Default .
columnTickEverynumber1
color"indigo" | "blue" | "purple" | "green" | "orange" | "pink" | "yellow" | "red" | "grey"—Colour of the scale (default indigo; calendar green). Correlation uses blue / red.
captionstring—Text under the grid, e.g. "2,384 contributions in 2026".
showLegendbooleantrue"Less ■■■■■ More" scale under the grid. Default true.
valueFormatterChartValueFormatter—
labelstring—
heightnumber—
state"ready" | "loading" | "empty" | "error"—
palette"shade" | "indigo""shade"shade paints the scale colour at a strength that follows the value; indigo paints five tonal steps from indigo 200 (low) to 600 (high), with the text colour picked per step. The correlation matrix keeps blue and red.
scaleLabelsreadonly [string, string]—The words at the two ends of the scale legend, such as Quiet and Busy. The correlation matrix defaults to -1 and +1.
activeIndexnumber | null—The active point (hovered or focused) as an index into , to control it yourself. shows none.
animateboolean—
animationKeystring | number—
defaultActiveIndexnumber | null—The point that is active at first, for an uncontrolled chart. It shows the tooltip without a pointer.
onActiveIndexChange(index) => void—Called with the index when the pointer or the arrow keys move to another point, and with when they leave. Use it to show the hovered value in a headline.
onRetry() => void—Shows a Try again button in the error state and calls this when it is pressed.
widthnumber—

Notes for AI

Give your coding assistant the Markdown reference instead of screenshots.

MCPget_component("heatmap")
InstallIncluded in Core and Pro

The full library index for assistants is at /llms.txt.