Appica UIUI 1.6.0

Treemap

A treemap recipe - Recharts drawn with Appica UI tokens, for the parts of a whole in 2 levels.

A treemap divides 1 rectangle among the parts of a whole, sized by value and grouped by parent. Like every chart here it is a recipe: Recharts draws it and the chart layer themes it. Each example below is a complete file to paste and adapt.

Installation

Recharts is the only extra dependency, with react-is at the same version as react:

pnpm add recharts react-is

The examples import the chart layer from @/components/chart. If your project doesn't have it yet, copy it from the Charts page first.

Example

The data is nested: each group has children, and the leaves carry the value. Here the theme hands out the colors, 1 per top-level group in the order of the data, which is the same fixed order as chartColors. nodeGap separates the tiles and label prints the names that fit. Like Sankey, a Treemap takes no responsive: Chart sizes it.

Loading

Accessibility

  • Pass aria-label to the chart with what it shows ("Sales by category and product"). It becomes the accessible name of the SVG.
  • Keep to 5 groups, the number of series colors. The labels and the tooltip name every tile, so nothing depends on color alone.
  • A tile too small for its label still has a tooltip. When readers need every value, show a Table beside the chart.
  • Nothing animates under reduced motion.

© 2026 Appica UI. A free component library, crafted by the Appica team.