BalanceReckon Design System
Others

TreeView

A tree view presents a hierarchical list.

import { flattenTreeData, TreeView } from '@balance-web/tree-view';
Loading demo…

A tree view presents a hierarchical list.

Usage

The TreeView component will handle the expand/collapse behaviour.

NOTE: It's important that we use React.useMemo (ref) when flattening our data to ensure that it isn't recreated on every render. Otherwise the component will behave unexpectedly.

Loading demo…

Selection

Use the onSelect and isSelected properties to manage node selection.

NOTE: The component uses the id property internally to track branches, so you must use another key to identify nodes. In this example we're using nodeID.

Loading demo…

Rendering

Using the nodeRenderer compose Balance components to create the desired interface.

NOTE: It's important that we use React.useCallback (ref) when creating our nodeRenderer to ensure that it isn't recreated on every render. Otherwise you could see performance issues.

Loading demo…

On this page