Componentcharts0.95 KB gzipZero dependencies
Treemap Chart
Squarified treemap with recursive rectangles and staggered labels
Preview
Live Preview
Installation
Tokens guide →Add to your project via CLI (zero dependencies, code you own):
npx bigbullui add treemap-chartOr install the full npm package:
npm install bigbulluiUsage
tsx3 lines
import { TreemapChart } from "@/components/ui/treemap-chart"; <TreemapChart items={items} />Source code
treemap-chart.tsx + 1 helperZero third-party dependencies (2 local files shown in tabs below).
tsxtreemap-chart.tsx156 lines
"use client"; import * as React from "react";import { cn } from "./lib/utils"; export interface TreemapItem { label: string; value: number; children?: TreemapItem[];} interface Rect { x: number; y: number; width: number; height: number; label?: string;}Props
| Prop | Type | Description |
|---|---|---|
| items | TreemapItem[] | Structured list of items rendered by the component. (Default: []) |
| className | string | Optional Tailwind or custom CSS classes merged with component styles. |