Calm motion: animations on this site only fade, with no movement
Treemap
Part-to-whole as nested rectangles, with drill-down
One rectangle per item, sized by its value, grouped into the things that contain them: disk use, a budget, traffic by section, a bundle. It answers "what takes up the space?" at a glance. For a few parts of one total, a MeterGroup is clearer. For a trend, Sparkline. For exact numbers, a DataTable.
Repository size
Arrow keys move between tiles, Enter opens or selects, Backspace goes up.
Last picked: nothing yet
datais a tree of{ id, label, value?, children?, color? }. A leaf's size is itsvalue. A group's is the sum of what it holds. Items with no size are left out. Tiles are squarified so they stay near square and readable.- Click or press Enter on a group to open it. The path above (
v-model:path, ids from the top) shows where you are. Any step of it goes back, and Backspace goes up one level. A leaf only emitsselect. - Keyboard: one tile is in the tab order. arrow keys move to the nearest tile that way, Home / End jump. Every tile is named with its label, size, share of the level and whether it holds more: readable even when the tile is too small to print its text.
- Each top-level node gets one chart color and everything inside it keeps it. Set
coloron a node (a token name or any CSS color) to choose. Tiles are tinted, never solid, so their text keeps its contrast. - It fills the width and is
heightpx tall. It re-lays out as the width changes.formatputs units on sizes.
Usage
ts
import { BlessTreemap } from "blessing-ui";API
Props
| Name | Type | Default | Description |
|---|---|---|---|
data* | TreemapNode[] | — | |
height | number | 320 | |
format | ((v: number) => string) | — | text for a size, e.g. `(v) => v + " MB"` |
label | string | "All" | name of the top level in the path, and of the whole chart for screen readers |
labels | Partial<{ tile: (label: string, value: string, share: string, children: number) => string; path: string; up: string; hint: string; }> | — | |
path | string[] | [] | ids from the top down to the level being shown |
Events
| Name | Payload | Description |
|---|---|---|
select | [node: TreemapNode, path: string[]] | |
update:path | [value: string[]] |