Treemap

Squarified so tiles stay close to square. Area equals value; point at one and it lifts while a card gives its share. Charts.

Open playground

About

Treemap is a React component in the Charts category of smoui. It is typed, ships no stylesheet, follows your theme through CSS variables, and honors prefers-reduced-motion. Import it with import { Treemap } from "@ashutoshswamy/smoui" and set data, prefix.

Install

Terminal
npm i @ashutoshswamy/smoui

Usage

TSX
import { Treemap } from "@ashutoshswamy/smoui";

<Treemap data={[{ label: "Subscriptions", value: 420 }, { label: "Services", value: 260 }]} />

Props 2

data

Tile area is proportional to value.

{ label: string; value: number }[]
prefix / suffix

Wrap values, or pass `format`.

string