Charts guide
Treemap
Nested data laid out as proportional rectangles.
Install
npx shadcn@latest add @foldcn/treemapTreemap parameters
| Parameter | Type / props | Behavior |
|---|---|---|
data | HierarchyNode | HierarchyNode[] | Nested { name, value?, children? } nodes. |
dataKey / nameKey | string | Numeric value and label fields. Defaults to value / name. |
width / height | number | SVG dimensions. |
responsive | boolean | Fits the SVG to the available width. |
padding / nodeInset / nodeGap / aspectRatio | number | Treemap cell inset, gap, and squarify ratio. |
type / content / focusPath / onNodeClick | flat | nest / callback / number[] / callback | Treemap rendering and caller-owned drill-down state. |
onNodeHover / activeTooltip | callback / { name, value, x, y, color } | null | Caller-owned treemap hover state and tooltip display. |
innerRadius / outerRadius / ringPadding | number | Sunburst ring limits and spacing. |
cx / cy / startAngle / endAngle | number | Sunburst center and angular span. |
textOptions | { fill?: string } | Sunburst value label color; none hides labels. |
title / className | string | Accessible SVG label and wrapper class. |
Uses a squarified rectangle layout with custom content, nested drill-down, and caller-owned pointer-following hover tooltips.
Examples
The first example is open. Expand Source inside an example to view its code. Other examples load when opened.
Measured entry
www/src/views/IndexView/IndexLineChart.tsxTree-shaken total906.15 KB
Minified + gzip98.70 KB
Source data is ported. Visual details or interactions may still differ from Recharts.
View the Recharts example