ComponentsTree View

TreeView

A Tree View displays hierarchical data and helps users explore nested categories. Tree structures are built using HvTreeItem or a custom variation of it.

GitHub LogoSource Code

Data object

Sometimes the tree data is in an object shape. These can be easily converted to HvTreeItem nodes using a recursive renderItem function.

Controlled

The TreeView can be controlled using the expanded/onNodeToggle props for expansion state, and selected/onNodeSelect for selection state. When multiSelect is enabled, values and callbacks use string[]; otherwise, they use a single string.

Loading data

In cases where tree data is paginated or partially loaded, you can use a custom LoadingItem to indicate server-side data fetching. This approach allows dynamic expansion as new data becomes available.

Custom tree view

The following example demonstrates a custom tree view that implements a common vertical navigation pattern.

  • Overview

  • Analytics