TreeMap

@nivo/treemaphierarchysvgisomorphic

A tree map component using d3-hierarchy.treemap, see this demo.

You can fully customize it using nodeComponent property to define your own node component, if you wish to do so you should have a look at native SVG node component for available properties.

The responsive alternative of this component is ResponsiveTreeMap, it also offers other implementations, see TreeMapHtml and TreeMapCanvas.

The TreeMap component is also available in the @nivo/api, see sample or try it using the API client.

Actions Logs
Start interacting with the chart to log actions
Base
objectrequired
The hierarchical data object.
string | Functionoptionaldefault:'id'
The key or function to use to retrieve nodes identity.
string | Functionoptionaldefault:'value'
The key or function to use to retrieve nodes value.
stringoptionaldefault:'squarify'
squarify
Strategy used to compute nodes.
booleanoptionaldefault:false
   Only render leaf nodes (no parent).
numberoptionaldefault:0
px
Padding between parent and child node.
numberoptionaldefault:0
px
Padding between parent and child node.
objectoptional
px
px
px
px
Chart margin.
Style
string | Function | string[]optionaldefault:{"scheme":"nivo"}
nivo
Defines how to compute node color.
numberoptionaldefault:0
px
Control node border width.
string | object | Functionoptionaldefault:{"from":"color"}
inheritthemecustom
inherited property
color
modifiers
darker
Method to compute border color.
Labels
booleanoptionaldefault:true
   Enable/disable labels.
string | Functionoptional
loc
Label accessor.
numberoptional
px
Skip label rendering if node minimal side length is lower than given value, 0 to disable.
booleanoptional
   Orient labels according to max node width/height.
string | object | Functionoptional
inheritthemecustom
inherited property
color
modifiers
darker
Method to compute label text color.
Interactivity
booleanoptionaldefault:true
   Enable/disable interactivity.
Functionoptional
onClick handler, it receives clicked node data and style plus mouse event.
Motion
booleanoptionaldefault:true
   Enable/disable transitions.
numberoptionaldefault:90
Motion stiffness.
numberoptionaldefault:13
Motion damping.