Treemap

Squarified treemap for visualizing part-to-whole hierarchical data.

Category: chart · WCAG 2.1-AA · chart, treemap, hierarchy, part-to-whole, data-viz

Props

PropTypeDefaultDescription
data{ id: string; label: string; value: number }[]The hierarchical data to render as nested rectangles.
titlestringTitle text for the component.
descriptionstringSupporting description text.
widthnumberFixed SVG width in px. ⚠ **Omit for a responsive chart** — the chart fills and tracks its container via a ResizeObserver; there is no correct pixel number in a responsive grid. A fixed width is clamped to the container (max-inline-size: 100%) so it can never overflow its card, but it also stops the chart growing. `useChartSize` is NOT needed for this — charts call it internally.
heightnumber320SVG height in px. Unlike `width`, height does NOT track the container — this is the knob you set to change the chart's aspect.
classNamestringAdditional CSS class names merged onto the root element.
plainbooleanfalseMarks only — no axes, grid lines, or legend. For micro/inline charts.

Design tokens

When to use

When not to use

Examples

Basic treemap

import { Treemap } from '@cascivo/charts'

const data = [
  {id:'a',label:'Alpha',value:40},
  {id:'b',label:'Beta',value:25},
  {id:'c',label:'Gamma',value:20},
  {id:'d',label:'Delta',value:15},
]
<Treemap data={data} title="Market share" />

Related components

← Back to docs