Skip to content
↑↓ to navigate↵ to openesc to close

Menu

Treemap

Preview

Portfolio allocation

Demo data

  • Technology
  • Healthcare
  • Finance
  • Energy
Portfolio allocation data
ItemValueShare of totalDetails
Technology / AAPL$210K17.9%
Technology / MSFT$190K16.2%
Technology / NVDA$130K11.1%
Healthcare / LLY$128K10.9%
Healthcare / UNH$85K7.2%
Healthcare / JNJ$45K3.8%
Finance / JPM$80K6.8%
Finance / V$95K8.1%
Finance / BAC$30K2.6%
Energy / XOM$74K6.3%
Energy / CVX$62K5.3%
Energy / SHEL$44K3.8%

Install

Add it with your package manager, or copy the source manually.

Run it in a project set up with shadcn-vue. The source is copied to components/beui and its dependencies are added to your package.json. Read the shadcn-vue guide

bunx --bun shadcn-vue@latest add @beui-vue/treemap

Import the shared styles once in your application.

TSUsage
import Treemap from '@/components/beui/charts/Treemap.vue'
import '@/components/beui/styles.css'

API Reference

Treemap

data
readonly TreemapNode[]

Flat leaves or nested groups. Tile area uses leaf values; groups sum their descendants.

Default—
label?
string
Default—
formatValue?
(value: number) => string
Default—
colors?
readonly string[]

Top-level palette; nodes can override their inherited color and textColor.

Default—
textColor?
string
Default—
v-model:activeId?
string | null
Default—
defaultActiveId?
string | null
Default—
@active-change?
(id: string | null) => void
Default—
labels?
Partial<TreemapMessages>

Override any built-in string.

Default—
class?
string
Default—
#default?
slot

Compose `TreemapPlot`, `TreemapTooltip` and `TreemapLegend`; omit it for the complete chart.

Default—

TreemapLegend

class?
string
Default—
showValues?
boolean
Defaultfalse

TreemapPlot

class?
string

Sets the plot height; default 20rem. The layout follows its measured dimensions.

Default—
tileClass?
string

Classes added to every tile button.

Default—
#renderTile?
{ tile: TreemapTileData }

Presentation content for one tile; each tile still owns its button and accessible name.

Default—

TreemapTooltip

class?
string
Default—
side?
"top" | "right" | "bottom" | "left"
Defaulttop
#default?
{ item: TreemapItem }

Replaces the default content. Receives the inspected item.

Default—

Updated