TreemapProv1.0.0
A whole split into nested tiles sized by value, laid out squarified so they stay near square. Click a tile (or press Enter) to step inside, and the breadcrumb, Escape or Backspace steps back out; each tile shows its own children as hairlines; arrow keys move between tiles by where they sit.
Squarified treemaps (Bruls, Huizing, van Wijk)
pnpm dlx shadcn@latest add @beautiful-ui-pro/lumen-treemapNeeds your registry key. Your components.json style picks the Base UI or Radix build: radix-*, new-york and default get Radix, base-* gets Base UI.
Styles didn't apply?
The CLI adds the styles to the CSS file named in components.json (tailwind.css). Check that it points at your global stylesheet, that the project uses Tailwind CSS v4, and that the file is imported in your root layout. Installed by hand: paste styles.css into that file.
Usage
Import it and pass your content. The props that matter most are listed next.
"use client";
import * as React from "react";
import { Treemap, type TreemapNode } from "@/components/ui/lumen/charts/treemap";
const spend: TreemapNode[] = [
{ id: "eng", name: "Engineering", children: [{ name: "Cloud", value: 420000 }, { name: "Tools", value: 96000 }, { name: "Contractors", value: 180000 }] },
{ id: "gtm", name: "Go to market", children: [{ name: "Ads", value: 260000 }, { name: "Events", value: 140000 }] },
{ id: "ops", name: "Operations", children: [{ name: "Office", value: 120000 }, { name: "Legal", value: 60000 }] },
];
const config = {
eng: { label: "Engineering", color: "var(--chart-1)" },
gtm: { label: "Go to market", color: "var(--chart-2)" },
ops: { label: "Operations", color: "var(--chart-3)" },
};
export function SpendTreemap() {
const [path, setPath] = React.useState<string[]>([]);
return <Treemap data={spend} config={config} path={path} onPathChange={setPath} valueFormat={{ style: "currency", notation: "compact" }} label="Spend by team" />;
}Props
data–TreemapNode[]The top level: { id?, name, value?, children? }. A parent's value is the sum of its children's.
config–ChartConfigColour and label per top-level id; deeper tiles take their branch's colour, brighter when bigger.
path / defaultPath / onPathChange[]string[]The ids from the top to the level shown; controlled or not.
onSelect–(path, node) => voidA leaf tile was clicked or Enter pressed on it.
valueFormat–StatFormat | (n) => stringNumbers on tiles, breadcrumb total, live region, table and summary.
labels–{ root?, path?, of?, open? }Words for i18n: the top crumb ("All"), the breadcrumb's name, "of" and the "Enter to open" hint.
Show all 9 propsShow fewer
gap / height3 / 320number / numberGap between tiles and plot height in px.
motion"full""full" | "subtle" | "off"Tiles settle in when a level opens and glide when values change; reduced motion always wins.
loading / error / emptyText / label–boolean / string / string / stringStates in words with the height held, and the chart's accessible name.
Source
components/ui/lumen/charts/treemap.tsx
This component is included with Pro.
Try the live preview above. Get Pro to install the source.