Componentcharts0.95 KB gzipZero dependencies

Treemap Chart

Squarified treemap with recursive rectangles and staggered labels

Preview

Live Preview
Open ↗

Installation

Tokens guide →

Add to your project via CLI (zero dependencies, code you own):

npx bigbullui add treemap-chart

Or install the full npm package:

npm install bigbullui

Usage

tsx3 lines
import { TreemapChart } from "@/components/ui/treemap-chart"; <TreemapChart items={items} />

Source code

treemap-chart.tsx + 1 helper

Zero 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

PropTypeDescription
itemsTreemapItem[]Structured list of items rendered by the component. (Default: [])
classNamestringOptional Tailwind or custom CSS classes merged with component styles.