ValyroUI Русская версия

Treemap

Hierarchies as areas, with drill-down. Pro · Charts and analytics › Shares and composition

Installation

npx valyro-cli@latest login
npx valyro-cli@latest add treemap
npm install valyro-ui-pro

import 'valyro-ui-pro/styles.css';
import { Treemap } from 'valyro-ui-pro';

Props

PropTypeDefault
data *TreemapNode[]Top-level nodes; tile area follows each leaf's value (groups: the sum of their children).
heightnumber360Plot height in px; width follows the container. Default 360.
colorBy'group' | 'value''group'group: each top-level node gets a palette color. value: one color, darker for larger values.
colorstring'var(--ui-chart-1)'Color of the value scale. Default --ui-chart-1.
depthnumber2Levels drawn at once: groups with a header and their children inside. Default 2.
drillDownbooleantrueClick or Enter on a tile zooms into its group; a breadcrumb leads back. Default true.
onNodeClick(node: TreemapNode, path: TreemapNode[]) => voidCalled on click / Enter with the node and its ancestors (outermost first).
valueFormatterValueFormatterFormats values on the tiles, in the tooltip and the data table.
localestringBCP 47 locale for the default number formatting. Default: the ThemeProvider locale, then the browser's.
labelsPartial<TreemapLabels>Overrides for the built-in strings.
loadingbooleanfalseShows a placeholder of the same height while data loads.
actionsReactNodeContent at the end of the breadcrumb row (with drillDown), e.g. a hint or the selected path.
ariaLabel *stringAccessible name of the chart (also the caption of its sr-only data table).

Related components

Previous: Donut Chart · Next: Funnel Chart · All Charts and analytics