Skip to content

ChartsLumen Halo

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)

.md
pnpm dlx shadcn@latest add @beautiful-ui-pro/lumen-treemap

Needs 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.

Set up the Beautiful UI registry

Free pieces install from their URL with no setup (that URL gives the Base UI build; Radix projects use /r/radix-nova/<name>.json, or add the registries below and the CLI picks your build). Pro pieces need the registries below and BEAUTIFUL_UI_TOKEN in .env.local.

components.json
{
  "registries": {
    "@beautiful-ui": "https://beautiful-ui.dev/r/{style}/{name}.json",
    "@beautiful-ui-pro": {
      "url": "https://beautiful-ui.dev/r/pro/{style}/{name}.json",
      "headers": { "Authorization": "Bearer ${BEAUTIFUL_UI_TOKEN}" }
    }
  }
}

MCP server

claude mcp add --transport http beautiful-ui https://beautiful-ui.dev/api/mcp
Catalog for agents: /llms.txt

Usage

Import it and pass your content. The props that matter most are listed next.

Example
"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–

    ChartConfig

    Colour 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) => void

    A leaf tile was clicked or Enter pressed on it.

  • valueFormat–

    StatFormat | (n) => string

    Numbers 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 props
  • gap / height3 / 320

    number / number

    Gap 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 / string

    States 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.