Skip to content
ChartslibraryUI
Get Pro
By Boris Marino · Updated 2026-12-01

shadcn Heatmap Chart: When to Use One and How to Install It

The shadcn/ui charts don't include a heatmap, and Recharts has no heatmap component either. Search for one and you find GitHub-style contribution calendars, which are a different chart. This guide covers what a matrix heatmap is good for, the choices that make one honest, and how to install one in a shadcn project.

What a heatmap is for

A heatmap is a grid: rows are one category, columns are another, and each cell's colour shows a value. It works when you have many cells and the pattern matters more than any single number:

  • Usage by weekday and hour: when do customers use the product?
  • Variance to plan by region and month: where are we behind, and since when?
  • Conversion by channel and step, error rate by service and day, margin by product and quarter.

If you have a handful of values, a grouped bar chart is easier to read exactly. If the columns are dates across a year, use a calendar heatmap. For signup cohorts, use a cohort heatmap.

The checklist

  1. The right kind of colour scale. Magnitudes (counts, revenue) need one hue from light to dark. Values above and below a centre (variance to plan, growth) need two hues with a neutral middle. A rainbow scale is never right: it invents boundaries that aren't in the data.
  2. Missing cells look missing. An empty cell should not take the lowest colour, because then "no data" reads as "zero". Hatched or blank, with a note saying how many.
  3. Duplicates are caught. If two rows fill the same cell, the chart should tell you to aggregate first rather than silently pick one.
  4. Outliers don't flatten everything. One huge cell can push every other cell into the palest colour. Being able to fix the colour range (and say in the legend that values beyond it take the end colour) solves this.
  5. Values in cells when they fit. Colour shows the pattern, numbers make it checkable.
  6. A legend and a table view. People need to read what a colour means, and screen-reader users need the numbers.

Install one with the shadcn CLI

ChartslibraryUI's heatmap passes all six. It's part of Pro. After buying, install it with your access key:

pnpm dlx shadcn@latest add @chartslibraryui/heatmap

The data is long format, one row per cell, so it comes straight from a SQL GROUP BY:

const usage = [
  { day: "Mon", hour: "09:00", sessions: 1240 },
  { day: "Mon", hour: "10:00", sessions: 1510 },
  { day: "Tue", hour: "09:00", sessions: 1180 },
  // ...
];
<Heatmap title="Usage peaks on weekday mornings" data={usage} row="day" column="hour" value="sessions" />

For variance to plan, switch to a diverging scale centred on zero:

<Heatmap
  title="EMEA has been behind plan since July"
  data={variance}
  row="region"
  column="month"
  value="vsPlan"
  format="percent"
  scale="diverging"
  center={0}
/>

Missing cells are hatched with a note, duplicate cells are reported, domain fixes the colour range, and rowOrder and columnOrder keep weekdays and months in calendar order.

Keep heatmaps readable

  • Order rows and columns on purpose: calendar order for time, largest first for categories.
  • Put the finding in the title: "Usage peaks on weekday mornings", not "Sessions by day and hour".
  • Up to about 30 columns on a dashboard; beyond that, aggregate (weeks instead of days).

Try the free charts in your app

35 charts, MIT, one command each.

More

Sign in to ChartslibraryUI

New here? The same step creates your account.

Continue with Google
or

No password needed. Bought Pro? Use the email you paid with and your license is there. By signing in you agree to the Terms and Privacy policy.