Usage
Treemap is based on the Treemap recharts component.
It displays data as rectangles with areas proportional to their values.
This example shows which modules contribute most to a JavaScript bundle's size:
JavaScript bundle size
Illustrative build · minified size
Nested data
Each data item can have a children array.
Here, modules are grouped by output chunk and inherit their chunk's color:
Bundle size by chunk
Illustrative build · minified size
Legend
Set withLegend to display a legend for top-level nodes.
Hover over a legend item to highlight its branch:
Legend position
The legend is displayed below the chart by default.
Set legendProps={{ position: 'top' }} to display it above the chart:
Node color
color accepts theme colors and any valid CSS color.
Nodes without color get a color from a default palette:
Text color
Set textColor to use the same label color on all nodes:
Value formatter
Use valueFormatter to format values in the tooltip:
Sales by product · October 2026
Data key
By default, node values are read from the value key. Set dataKey to use another key:
Node stroke
Use strokeWidth and strokeColor props to change the stroke around nodes:
Disable tooltip
To disable the tooltip, set withTooltip={false}: