Skip to content

Heatmap

ChartsSince 0.4.0

An accessible SVG heatmap: a matrix of values over two categorical axes (columns along x, rows along y). Each cell’s fill encodes its value on a scale of discrete steps:

  • sequential (default): one palette slot, light to dark;
  • diverging: two palette slots on either side of a midpoint.

Fill lightness alone is a weak cue, so it is never the only one:

  • cells print their values when the formatted value fits (cellLabels);
  • the legend lists every step’s value range;
  • every cell is keyboard-reachable in two dimensions (one tab stop, arrow keys) with a tooltip, and its accessible name carries the exact value;
  • the data table holds the exact matrix, and a generated summary names the size and the extremes.

Nothing animates.

  • Color scalesSequential or diverging steps around a midpoint, listed in the legend.
  • Cell labelsCells print their values when the formatted value fits.
  • Grid keyboardOne tab stop; arrow keys move across rows and columns with a tooltip.
  • Data table fallbackThe exact matrix as a table, with a summary of size and extremes.

Use it for

  • Showing patterns across two categorical dimensions (weekday by hour, region by month, feature by segment).
  • Diverging data around a meaningful midpoint (change from baseline, correlation): use colorScale.type ‘diverging’.

Use something else for

  • When exact comparison of a few values matters: use Bar Chart (fill lightness is a weak cue).
  • Continuous x and y values: use Scatter Chart.
  • Very large matrices (thousands of cells): aggregate first; every cell is a DOM element.
Anatomy
<div class="aui-chart aui-heatmap [aui-chart--patterns]">
<div class="aui-chart__header">title, description</div>
<ul class="aui-chart__legend" aria-label="Legend"><li><span class="aui-chart__legend-item">swatch, 0 to 2</span></li>...</ul>
<div class="aui-chart__body">
<svg class="aui-chart__svg" role="group" aria-roledescription="heatmap" aria-labelledby="T" aria-describedby="S">
<g class="aui-chart__axis" aria-hidden="true">column and row labels</g>
<g class="aui-heatmap__cells">
<rect class="aui-heatmap__cell aui-chart__series--c1 aui-heatmap__level--60 aui-chart__mark" role="img" aria-label="12, Tue: 4" tabindex="0"/>
<rect class="aui-heatmap__cell aui-heatmap__cell--empty aui-chart__mark" role="img" aria-label="9, Tue: No value"/>
</g>
<g class="aui-heatmap__labels" aria-hidden="true"><text class="aui-chart__value-label">4</text>...</g>
</svg>
<div class="aui-chart__tooltip" aria-hidden="true" hidden/>
</div>
<p class="aui-chart__summary" hidden/> <div class="aui-chart__data">Show data table, table</div>
</div>

Use the bar above each frame to switch theme, density, direction, and locale.

The part of the Analysis showcase that uses Heatmap. Change its options, use it with the keyboard, and watch the event log; the link in the frame opens the full showcase. The bar above the frame switches theme, density, direction, and locale.

Showcase source
// Advanced charts showcase: an analysis page with a bubble chart (zoom, crosshair, a target
// line), a combo chart on two axes with a custom tooltip, a profit bridge (waterfall), a
// histogram with a reference band, a heatmap, and box plots. Style and animation
// are switchable; point clicks are logged.
import { BoxPlot } from '@absoluteui/components/box-plot';
import { ComboChart } from '@absoluteui/components/combo-chart';
import { Heatmap } from '@absoluteui/components/heatmap';
import { Histogram } from '@absoluteui/components/histogram';
import { ScatterChart } from '@absoluteui/components/scatter-chart';
import { WaterfallChart } from '@absoluteui/components/waterfall-chart';
import type { ChartTooltipContext } from '@absoluteui/components/combo-chart';
import { chartControls, chartLook, choice, createShowcase, hostIn, section, toggle } from './kit.js';
const sc = createShowcase({
title: 'Analysis',
description: 'Six analytical charts on one page. Every chart works with the keyboard, has a data table, and can use patterns instead of color alone.',
});
const seeded = (seed: number): (() => number) => {
let s = seed;
return () => {
s = (s * 16807) % 2147483647;
return s / 2147483647;
};
};
const rnd = seeded(42);
const s1 = section(sc, 'Accounts: revenue against satisfaction', ['scatter-chart']);
const scatter = ScatterChart.create(hostIn(s1), {
label: 'Accounts by revenue and satisfaction',
description: 'Bubble size is the number of seats.',
series: ['Enterprise', 'Mid-market', 'Small business'].map((label, k) => ({
id: label.toLowerCase().replace(/\s+/g, '-'),
label,
points: Array.from({ length: 12 }, (_, i) => ({ x: Math.round((k + 1) * 40 + rnd() * 120), y: Math.round(50 + rnd() * 50), size: Math.round(10 + rnd() * 300), label: `${label} ${String(i + 1)}` })),
})),
xAxis: { label: 'Annual revenue (k€)' },
yAxis: { label: 'Satisfaction score', min: 40, max: 100 },
sizeLabel: 'Seats',
zoom: 'xy',
crosshair: true,
annotations: [{ type: 'line', axis: 'y', value: 75, label: 'Satisfaction target', tone: 'success' }],
height: 300,
});
/** Custom tooltip (DOM nodes, never HTML strings): the category and each series on its own line. */
const comboTooltip = (context: ChartTooltipContext): Node => {
const box = document.createElement('div');
const title = document.createElement('strong');
title.textContent = context.title;
box.append(title);
for (const r of context.rows) {
const line = document.createElement('div');
line.textContent = `${r.label}: ${r.value}`;
box.append(line);
}
return box;
};
const grid = hostIn(sc.stage);
grid.className = 'sc-grid';
const comboSection = section(sc, 'Orders and conversion', ['combo-chart']);
const bridgeSection = section(sc, 'Profit bridge', ['waterfall-chart']);
const histSection = section(sc, 'Resolution times', ['histogram']);
const heatSection = section(sc, 'Requests by day and hour', ['heatmap']);
grid.append(comboSection, bridgeSection, histSection, heatSection);
const combo = ComboChart.create(hostIn(comboSection), {
label: 'Orders and conversion',
categories: ['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun'],
series: [
{ id: 'orders', label: 'Orders', type: 'bar', values: [420, 460, 510, 480, 560, 610] },
{ id: 'conversion', label: 'Conversion rate', type: 'line', axis: 'secondary', values: [0.021, 0.023, 0.026, 0.024, 0.028, 0.031] },
],
primaryAxis: { label: 'Orders' },
secondaryAxis: { label: 'Conversion', format: { style: 'percent', maximumFractionDigits: 1 } },
crosshair: true,
annotations: [{ type: 'line', axis: 'y', value: 500, label: 'Order goal' }],
height: 260,
});
const bridge = WaterfallChart.create(hostIn(bridgeSection), {
label: 'Profit bridge',
steps: [
{ id: 'start', label: 'Revenue', kind: 'total', value: 1200 },
{ id: 'cogs', label: 'Cost of sales', value: -480 },
{ id: 'opex', label: 'Operating costs', value: -310 },
{ id: 'other', label: 'Other income', value: 45 },
{ id: 'tax', label: 'Tax', value: -110 },
{ id: 'net', label: 'Net profit', kind: 'total' },
],
valueFormat: { style: 'currency', currency: 'EUR', notation: 'compact' },
valueLabels: true,
connectors: true,
height: 260,
});
const hist = Histogram.create(hostIn(histSection), {
label: 'Ticket resolution times',
values: Array.from({ length: 400 }, () => Math.round(Math.abs(8 + (rnd() + rnd() + rnd() - 1.5) * 10) * 10) / 10),
bins: 'auto',
xAxis: { label: 'Hours' },
yAxis: { label: 'Tickets' },
annotations: [{ type: 'band', axis: 'x', from: 0, to: 4, label: 'Within SLA', tone: 'success' }],
height: 260,
});
const DAYS = ['Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat', 'Sun'];
const HOURS = ['08', '10', '12', '14', '16', '18', '20'];
const heat = Heatmap.create(hostIn(heatSection), {
label: 'Support requests by day and hour',
columns: HOURS,
rows: DAYS,
values: DAYS.map((_, d) => HOURS.map((__, h) => (d > 4 ? Math.round(rnd() * 8) : Math.round(10 + rnd() * 30 + (h === 1 || h === 4 ? 15 : 0))))),
cellLabels: 'auto',
height: 260,
});
const box = BoxPlot.create(hostIn(section(sc, 'Salaries by grade', ['box-plot'])), {
label: 'Salaries by grade',
categories: ['G1', 'G2', 'G3', 'G4'],
series: [
{ id: 'eu', label: 'Europe', data: [0, 1, 2, 3].map((g) => Array.from({ length: 30 }, () => 30 + g * 15 + rnd() * 20)) },
{ id: 'in', label: 'India', data: [0, 1, 2, 3].map((g) => Array.from({ length: 30 }, () => 12 + g * 8 + rnd() * 10)) },
],
valueAxis: { label: 'Salary (k€)' },
annotations: [{ type: 'line', axis: 'y', value: 50, label: 'Median market salary', tone: 'info' }],
height: 280,
});
for (const [name, chart] of [
['scatter', scatter],
['combo', combo],
['waterfall', bridge],
['histogram', hist],
['heatmap', heat],
['box plot', box],
] as const) {
sc.listen(chart.host, ['aui-series-toggle', 'aui-zoom', 'aui-point-click'], name);
}
chartControls(sc, [scatter, combo, bridge, hist, heat, box]);
chartLook(sc, [scatter, combo, bridge, hist, heat, box]);
toggle(sc, 'Custom combo tooltip', false, (custom) => {
combo.update({ renderTooltip: custom ? comboTooltip : undefined });
}, ['combo-chart']);
choice(
sc,
'Whiskers',
[
{ value: 'tukey', label: '1.5 × IQR (outliers shown)' },
{ value: 'minmax', label: 'Minimum to maximum' },
],
'tukey',
(whiskers) => {
box.update({ whiskers });
},
['box-plot'],
);
toggle(sc, 'Stack combo bars', false, (stacked) => {
combo.update({ stacked });
}, ['combo-chart']);
import { Heatmap } from '@absoluteui/components/heatmap';
const host = document.createElement('div');
document.body.append(host);
Heatmap.create(host, {
label: 'Support tickets by weekday and hour',
columns: ['9:00', '12:00', '15:00', '18:00'],
rows: ['Mon', 'Tue', 'Wed'],
values: [
[4, 12, 9, 3],
[6, 15, null, 2],
[5, 11, 8, 4],
],
colorScale: { color: 3, steps: 4 },
xAxis: { label: 'Hour' },
yAxis: { label: 'Weekday' },
height: 240,
});

Diverging scale around zero with percent values

Section titled “Diverging scale around zero with percent values”
import { Heatmap } from '@absoluteui/components/heatmap';
const host = document.querySelector<HTMLElement>('#change');
if (host) {
const chart = Heatmap.create(host, {
label: 'Change from last year',
columns: ['Q1', 'Q2', 'Q3', 'Q4'],
rows: ['North', 'South', 'East'],
values: [
[0.12, 0.05, -0.03, 0.08],
[-0.1, -0.04, 0.02, 0.01],
[0.03, 0.09, 0.15, -0.06],
],
colorScale: { type: 'diverging', midpoint: 0, negative: 2, positive: 1, steps: 3 },
valueFormat: { style: 'percent', maximumFractionDigits: 0 },
dataTable: 'visible',
});
chart.update({ cellLabels: 'none' });
}
Terminal window
npm install @absoluteui/components @absoluteui/core @absoluteui/theme

Registry setup, the theme stylesheet, and the Content Security Policy are covered in Installation.

import { Heatmap } from '@absoluteui/components/heatmap';
import '@absoluteui/components/heatmap/style.css';
import { Heatmap } from '@absoluteui/components/heatmap';
import '@absoluteui/components/heatmap/style.css';
const host = document.querySelector<HTMLElement>('#load');
if (host) {
Heatmap.create(host, {
label: 'Server load by day and hour',
columns: ['00', '06', '12', '18'],
rows: ['Sat', 'Sun'],
values: [[0.2, 0.35, 0.8, 0.6], [0.15, 0.3, 0.7, 0.55]],
valueFormat: { style: 'percent' },
colorScale: { min: 0, max: 1 },
});
}
More usage
import { Heatmap } from '@absoluteui/components/heatmap';
const host = document.createElement('div');
document.body.append(host);
Heatmap.create(host, {
label: 'Tickets by weekday and hour',
columns: ['9', '12', '15'],
rows: ['Mon', 'Tue'],
values: [[1, 5, 9], [null, 4, 2]],
});

Using Angular? See Heatmap for Angular.

Heatmap.create(host: HTMLElement, options: HeatmapOptions): Heatmap

Global configuration key: heatmap (see Configuration).

Option Type Default Description
label string Chart title: visible text and the accessible name of the plot (aria-labelledby); also the data table caption. Required.
hideLabel boolean false Visually hide the title; it stays the accessible name.
description string Visible description below the title, also referenced by aria-describedby (text only).
summary string Replaces the generated accessible summary (matrix size, lowest and highest value with their cells).
valueFormat Intl.NumberFormatOptions Number format for cell labels, legend step ranges, tooltips, the data table, and the summary.
formatValue (value: number) => string Custom value text; overrides valueFormat everywhere.
hiddenSeries readonly string[] Shared chart option; a heatmap has no series, so it has no effect.
columns readonly string[] Column labels (x axis), in order (mirrored in RTL). Required.
rows readonly string[] Row labels (y axis), top to bottom. Required.
values readonly (readonly (number | null)[])[] values[row][column]: exactly one array per row and one value per column. null, NaN, and infinities are empty cells (“No value”). Required.
colorScale HeatmapColorScale { type?: ‘sequential’ | ‘diverging’ (default sequential), color?: 1-8 (sequential slot, default 1), negative?: 1-8 (default 2), positive?: 1-8 (default 1), midpoint?: number (diverging center, default 0), min?, max? (fixed domain; default the nice-rounded data extent), steps?: 3-9 (per side for diverging, default 5) }. Values outside a fixed domain use the first or last step.
xAxis { label?: string } Column axis title (drawn below the plot).
yAxis { label?: string } Row axis title (drawn beside the row labels); also the header of the data table’s first column (default “Row”).
theme ChartTheme Look and feel: { palette?: string[] (1-8 CSS colors for slots 1-8); fontFamily?; fontSize? (8-32 px); textColor?; gridLines?: boolean; gridColor?; gridDash? (“4 2” or “none”); axisColor?; lineWidth? (0.5-12 px); markerSize? (1-20 px); cornerRadius?, barRadius?, cellRadius?, sliceRadius?, boxRadius? (0-50 px); swatchRadius? (0-8 px); tooltipRadius?, controlRadius? (0-50 px); lineJoin?: ‘round’ | ‘miter’ | ‘bevel’; areaOpacity? (0-1); gradient?: boolean; valueLabelColor?; tooltip?: { background?, color?, borderColor? }; legendPosition?: ‘top’ | ‘bottom’ | ‘start’ | ‘end’; animation?: boolean | { duration?: number (0-5000 ms) } }. Applied as –aui-chart-* custom properties and classes on the host through the CSSOM (CSP-safe); colors are validated with CSS.supports(‘color’). Animation is opt-in and never runs with prefers-reduced-motion: reduce or [data-aui-animation=‘none’].
renderTooltip (context: ChartTooltipContext) => Node | null Custom tooltip content as DOM nodes (never HTML strings). context: { title, rows: { label, value, seriesId }[], column, row, source: “pointer” | “focus” | “sync” }. Return null for the default tooltip. The tooltip stays aria-hidden; the focused mark keeps its accessible label.
syncGroup string Synchronized crosshair: charts with the same group show the crosshair, highlight, and tooltip at the same column (category or x index) when one of them is hovered or focused. Focus never moves between charts. Use charts that share their categories or x values.
legend 'auto' | 'show' | 'hide' "auto" Legend listing every color step with its value range; auto and show both show it, hide removes it. Entries are not toggle buttons. Globally configurable.
dataTable 'toggle' | 'visible' | 'hidden' | 'none' "toggle" Data table fallback with the exact matrix: behind a Show data table button (built on first open), always visible, visually hidden (screen readers only), or none. Globally configurable.
tooltip boolean true Tooltip on pointer hover and keyboard focus (cell name and value). Globally configurable.
patterns boolean false Shared chart option (toggles aui-chart–patterns); heatmap cells and step swatches are not textured, so it has no visible effect. Globally configurable.
height number 300 Plot height in CSS px (integer 120-2000); the width follows the container. Cells share the plot evenly. Globally configurable.
cellLabels 'auto' | 'always' | 'none' "auto" Values printed inside cells: auto and always print them where the formatted value fits (always skips cells that are too small); none prints no values. Globally configurable.
locale string "en-US" Number and message locale. Globally configurable. Inherited from common configuration.
direction 'ltr' | 'rtl' "ltr" rtl mirrors the columns (first column at the right), puts the row labels on the right, and swaps ArrowLeft/ArrowRight. Globally configurable. Inherited from common configuration.
Property Type Description
host HTMLElement The host element.
element SVGSVGElement The plot (svg role=“group”), named by the title and described by the summary.
summary string The generated (or custom) accessible summary.
hiddenSeries string[] Shared chart property; always empty for a heatmap.
Method Description
update(options: Partial<HeatmapOptions>): void Merge, validate, and re-render. Invalid options throw and keep the previous state. Keyboard focus stays on the same cell.
setSeriesVisible(id: string, visible: boolean): void Shared chart method; a heatmap has no series, so it only re-renders.
destroy(): void Remove rendering, host classes, listeners, the resize observer, and the configuration subscription.
Event Detail Bubbles Cancelable Description
aui-point-click HeatmapPointClickDetail = ChartPointClickDetail: { seriesId: string | null; column: number; row: number; label: string; series: string; value: string; source: 'pointer' | 'keyboard' } Yes No A data mark was activated: pointer click or tap, or Enter / Space on the focused mark. label is the category, x value, or item; value is the formatted value text. Keyboard navigation is unchanged.

All rules live in the aui.components cascade layer, so application styles override them without specificity battles.

Class Purpose
aui-chart Host (shared chart chrome).
aui-heatmap Host modifier for this chart type.
aui-chart--patterns patterns option on (no visible effect on heatmap cells).
aui-chart__header / __title / __title--hidden / __description Title and description.
aui-chart__legend / __legend-entry / __legend-item / __legend-label Legend of color steps (static entries, not buttons).
aui-chart__swatch aria-hidden legend and tooltip key (step fill).
aui-chart__body / __svg / __layer Plot container (height from –aui-chart-height), SVG, and drawing layer.
aui-chart__axis / __tick-label / __axis-title Column and row labels and axis titles (aria-hidden).
aui-chart__series--c1 ... --c8 Palette slot classes; set –aui-chart-color from color-chart-<n>.
aui-heatmap__level--15 ... --100 Fill strength in steps of 5: the palette color mixed into color-surface at that percentage (sets –aui-heatmap-fill).
aui-heatmap__cells / __cell / __cell--empty Cell group, focusable cells (also aui-chart__mark), and empty (null) cells.
aui-heatmap__labels aria-hidden group of printed cell values (aui-chart__value-label).
aui-chart__mark / __mark--active / __mark--hover Focusable cell and its states (thicker color-text outline).
aui-chart__value-label Printed values with a surface-colored halo.
aui-chart__tooltip / __tooltip-title / __tooltip-rows / __tooltip-row / __tooltip-label / __tooltip-value Tooltip (aria-hidden; the focused cell carries the same text).
aui-chart__empty Empty state text (No data).
aui-chart__summary Hidden summary referenced by aria-describedby.
aui-chart__data / __data--hidden / __table-toggle / __table-scroll / __table / __cell--numeric Data table fallback.
aui-chart--legend-bottom / --legend-start / --legend-end theme.legendPosition (top is the default layout).
aui-chart--no-grid / --gradient / --animate / --entering theme.gridLines: false, theme.gradient, theme.animation (entering: the render that animates).
aui-chart__annotations / __annotation-line / __annotation-band / __annotation-label / __annotation--<tone> Annotations (aria-hidden), drawn under the marks.
aui-chart__gradient / __gradient-stop Gradient fills (theme.gradient).
aui-chart__tooltip--custom Tooltip content comes from renderTooltip.

Tokens this stylesheet reads (verified in CI). Override them in a theme or with the Theme Designer.

--aui-border-width | --aui-color-border | --aui-color-border-strong | --aui-color-chart-1 | --aui-color-chart-2 | --aui-color-chart-3 | --aui-color-chart-4 | --aui-color-chart-5 | --aui-color-chart-6 | --aui-color-chart-7 | --aui-color-chart-8 | --aui-color-chart-axis | --aui-color-chart-grid | --aui-color-error-fg | --aui-color-focus-ring | --aui-color-hover | --aui-color-info-fg | --aui-color-link | --aui-color-success-fg | --aui-color-surface | --aui-color-surface-sunken | --aui-color-text | --aui-color-text-muted | --aui-color-warning-fg | --aui-duration-fast | --aui-easing-standard | --aui-focus-ring-offset | --aui-focus-ring-width | --aui-font-family-sans | --aui-font-size-md | --aui-font-size-sm | --aui-font-size-xs | --aui-font-weight-medium | --aui-font-weight-regular | --aui-font-weight-semibold | --aui-line-height-normal | --aui-line-height-tight | --aui-radius-md | --aui-radius-sm | --aui-shadow-md | --aui-space-1 | --aui-space-2 | --aui-space-3 | --aui-tooltip-max-width | --aui-touch-target-min

TypeScript definitions
type HeatmapCellLabels = 'auto' | 'always' | 'none';
interface HeatmapConfig extends ChartBaseConfig { cellLabels: HeatmapCellLabels }
interface HeatmapColorScale {
type?: 'sequential' | 'diverging'; // default 'sequential'
color?: ChartColor; // sequential slot, default 1
negative?: ChartColor; // diverging, below midpoint, default 2
positive?: ChartColor; // diverging, above midpoint, default 1
midpoint?: number; // default 0
min?: number; // default: data extent (nice-rounded)
max?: number;
steps?: number; // 3-9 (per side for diverging), default 5
}
interface HeatmapOptions extends ChartCommonOptions, Partial<HeatmapConfig> {
columns: readonly string[];
rows: readonly string[];
values: readonly (readonly (number | null)[])[];
colorScale?: HeatmapColorScale;
xAxis?: { label?: string };
yAxis?: { label?: string };
}

Pattern: SVG matrix chart as a named, described group (role=“group” with aria-roledescription “heatmap”) of role=“img” cells with two-dimensional roving focus; a legend listing every color step with its value range; data table fallback with the exact matrix.

Checked on every docs build: the showcase passes axe (WCAG 2.2 A and AA rules) in the default, dark, and high-contrast themes and right to left; the playground loads without errors and passes axe before and after every on/off option is switched, with no Content Security Policy violations.

Key Context Action
ArrowLeft / ArrowRight Cell focused Previous / next column in the same row (swapped in RTL).
ArrowUp / ArrowDown Cell focused Same column in the previous / next row.
Home / End Cell focused First / last cell of the row.
PageUp / PageDown Cell focused Ten columns back / forward in the row (clamped to the ends).
Escape Tooltip visible Hides the tooltip without moving focus (WCAG 1.4.13); it returns on the next move.
Tab / Shift+Tab Any One tab stop for the plot (the active cell), then the Show data table button and table region. Legend entries are not focusable.
Element Role
svg.aui-chart__svg group with aria-roledescription “heatmap” (localized), named by the title
cells (rect.aui-heatmap__cell) img with an aria-label: column, row, formatted value (or “No value”)
legend list (ul) named “Legend”; entries are static text (step ranges), not buttons
data table table (native) with caption, column headers (row axis title, then the columns), and row headers; wide tables scroll in a focusable region
row and column labels, axis titles, printed cell values, tooltip aria-hidden (decorative duplicates of the accessible data)
Attribute Element Value
aria-labelledby svg id of the visible (or visually hidden) title
aria-describedby svg description id (when provided) and the generated summary id
aria-roledescription svg Localized “heatmap”
aria-label each cell Localized “{column}, {row}: {value}”, for example “12, Tue: 4”; empty cells read “No value”
tabindex active cell 0 on exactly one cell (roving); other cells have none
aria-expanded / aria-controls Show data table button Table open state and the table region id

Roving focus: one cell is in the tab sequence and remembers the last visited cell, also across re-renders (resize, update, configuration changes). Every cell, including empty ones, is reachable. Toggling the table keeps focus on the table button.

Criterion Level Note
1.1.1 Non-text Content A
1.3.1 Info and Relationships A
1.4.1 Use of Color A
1.4.3 Contrast (Minimum) AA
1.4.10 Reflow AA
1.4.11 Non-text Contrast AA
1.4.13 Content on Hover or Focus AA
2.1.1 Keyboard A
2.4.3 Focus Order A
2.4.7 Focus Visible AA
4.1.2 Name, Role, Value A

Automated test results: Accessibility and compliance.

  • Fill lightness is a weak cue (and sequential steps of one hue are hard to tell apart), so it is never the only one: cells print their values when they fit (cellLabels), the legend lists every step’s value range, each cell’s accessible name and tooltip carry its exact value, and the data table holds the whole matrix.
  • The generated summary names the matrix size and the lowest and highest values with their cells, for example “heatmap, 2 rows by 3 columns. Lowest 1 at 9, Mon; highest 9 at 15, Mon.”
  • Cells are separated by a color-surface stroke, so neighboring fills need no mutual contrast; the hovered or focused cell gets a 2px color-text outline.
  • Forced colors: fills are not reliable, so cells become outlined boxes (Canvas fill, CanvasText stroke; Highlight for hover and focus); values remain available through the printed cell labels, accessible names, and the data table.
  • No animation.
  • Manual screen-reader verification (NVDA, JAWS, VoiceOver, TalkBack) is pending.
  • aria-roledescription support varies; screen readers without it announce “group”.
  • Large matrices mean many arrow presses; browse-mode users can read the data table instead.
Import cost Minified gzip brotli CSS brotli
@absoluteui/components/heatmap 48.1 kB 17.2 kB 15.4 kB 2.3 kB

Measured at build time, including every AbsoluteUI module the component pulls in. No third-party runtime dependencies.

Budget (enforced in CI) Limit
Heatmap.create with 24 x 30 cells, including the first render < 60 ms in headless Chromium (e2e performance test)

Tested scale: Designed for up to about 1,000 cells (for example 24 x 30 or 52 x 7); every cell is a focusable SVG rect.

Budget: Heatmap.create with 24 x 30 cells < 60 ms in headless Chromium (e2e performance test), including the first render. One number formatter per render; the data table is built lazily.

Measured run times: Performance.

States

default (sequential), diverging, empty (“No data”: no rows, no columns, or no finite values), empty cell, cell focused (tooltip), cell hovered, table open.

State transitions
From Trigger To
plot not focused Tab active cell focused, tooltip shown
cell focused arrow keys, Home, End, PageUp, PageDown another cell focused
tooltip visible Escape tooltip hidden
any update() / configuration change re-rendered; focus kept on the same cell
Accessibility notes
  • Trade-off: lightness steps of one hue are hard to tell apart, and color alone would fail WCAG 1.4.1. The heatmap therefore prints values in cells that fit them, lists each step’s range in the legend, exposes every value through the cell names and tooltips, and offers the exact matrix in the data table. Keep at least cellLabels or dataTable on.
  • Every cell (including empty ones) is keyboard-reachable in two dimensions.
  • The summary names the size and extremes: “heatmap, 2 rows by 3 columns. Lowest 1 at 9, Mon; highest 9 at 15, Mon.”
  • Cells are separated by a color-surface stroke, so neighboring fills need no mutual contrast.
  • Forced colors: fills are not reliable, so cells become outlined boxes (Canvas / CanvasText, Highlight on hover and focus); values stay available through the printed labels, accessible names, and the data table.
  • No animation. Manual screen-reader verification is pending.
Responsive behavior

The width follows the container (ResizeObserver); the height is height. Cells share the plot evenly. Row labels take at most 30% of the width and are truncated; column labels are truncated or thinned when crowded; cell values are printed only where they fit. Reflows at 320 CSS px.

Right-to-left

direction: 'rtl' puts the first column at the right and the row labels on the right, and swaps ArrowLeft/ArrowRight. The legend, tooltip, and table follow the document direction.

Theming

Step fills mix color-chart-<slot> into color-surface at 15-100% (color-mix), so they adapt to every theme; empty cells use color-surface-sunken. Lighter steps are intentionally low-contrast: meaning is carried by the printed values, legend, and table, not by the fill.

Global configuration
configureAbsoluteUI({ components: { heatmap: { cellLabels: 'none', dataTable: 'visible' } } });

Changes apply to existing instances immediately.

Component configuration

Instance options override global and theme defaults. All options are dynamic.

Security

All text uses textContent; SVG uses createElementNS; colors are classes. No innerHTML or style attributes.

Data handling

No persistence, network access, or telemetry.

Supported data scale

Up to about 1,000 cells; every cell is a focusable rect.

Edge cases
  • null, NaN, and infinities are empty cells (color-surface-sunken, “No value”); they are still focusable.
  • All cells empty, or no rows or columns: “No data”.
  • All values equal: every cell uses the same step.
  • Values outside a fixed colorScale.min/max use the first or last step; the legend then reads “Below …” / “Above …” at the ends.
  • Diverging scales are symmetric around midpoint (the larger distance sets both sides); the legend has 2 x steps entries.
Errors
Code Category Cause
HEATMAP_OPTIONS configuration Missing label; non-string columns or rows; values not one array per row with one number-or-null per column; invalid colorScale (type, slots, non-finite numbers, max <= min, steps outside 3-9); invalid axis titles or formatters.
CFG_INVALID_VALUE / CFG_UNKNOWN_OPTION configuration Invalid or unknown configuration.

A failed construction leaves the host untouched.

Known limitations
  • Discrete steps only; one slot (sequential) or two (diverging).
  • cellLabels: 'always' prints values only where they fit, like 'auto'.
  • Manual screen-reader verification is pending.
  • Animation is opt-in (theme.animation) and replays after each data or option change; it never runs with prefers-reduced-motion: reduce or [data-aui-animation='none'].
  • syncGroup matches charts by column index (category or x index); use it for charts that share their categories or x values.
  • No annotations (no cartesian value axes).
  • No zoom or pan: the grid already shows every cell; filter rows or columns instead.
Unsupported scenarios
  • Numeric or time axes, uneven cells, calendar layouts.
  • Clustering, sorting, selection.