Skip to content
TrademarkTrademark
Docs
Data

Treemap

Updated: November 16, 2026
View on GitHub

Treemap draws one tile per row of data, its area the row's value. With toneKey each tile is also coloured by a signed number, such as a change since purchase: above zero in the gain colour, below zero in the loss colour, stronger the further from zero. Use it when there are too many parts for a PieChart and their sizes matter more than their order. It takes the card, title, description, valueFormat, locale, tooltip, loading, error, emptyState and errorState the other charts take.

Rows without a positive value are left out, and tiles are laid out largest first so the biggest sit top left. A tile writes its name when it fits and subKey's text when there is room for a second line; its hover card and its accessible name always carry the value, the tone and that text.

Colour

Without toneKey every tile is neutral and area alone carries the data. With it, the strongest tone gets the strongest colour; set toneMax to fix that scale instead, so two treemaps compare (toneMax={0.5} paints anything at ±50% at full strength). Gains are emerald and losses orange by default, a pair that stays apart for colour-blind readers in light and dark; gainColor and lossColor take any palette name or CSS colour.

API reference

Type
Default
title
React.ReactNode—
description
React.ReactNode—
valueFormat
numbercompactpercentNumberFormatOptions(value: number) => string
—
locale
string—
tooltip
booleantrue
loading
boolean—
error
boolean—
emptyState
React.ReactNode—
errorState
React.ReactNode—
aria-label
string—
datarequired
One row per tile. Rows with no positive value are left out.
readonly DataPoint[]—
dataKey
The row key that sizes each tile. Defaults to "value".
SeriesKey<DataPoint>"value" as SeriesKey<T>
nameKey
The row key that names each tile. Defaults to "label".
SeriesKey<DataPoint>"label" as SeriesKey<T>
toneKey
The row key of a signed number that colours each tile: gains above zero, losses below.
SeriesKey<DataPoint>—
toneMax
The tone at full strength. Defaults to the largest tone in the data.
number—
toneFormat
How tones are written in the hover card. Defaults to valueFormat.
numbercompactpercentNumberFormatOptions(value: number) => string
—
subKey
The row key whose text is the tile's second line when it fits.
SeriesKey<DataPoint>—
gainColor
Tiles above zero. Defaults to emerald.
ColorValue—
lossColor
Tiles below zero. Defaults to orange.
ColorValue—
…and every FlexProps propinherited—
Edit this page on GitHub