Tree

A hierarchical, expandable tree rendered with Unicode box-drawing connectors. Navigate with ↑↓/jk, toggle with Enter/Space, and expand/collapse with →l/←h.

Install the package

Every component ships in the single dart_tui package.

$dart pub add dart_tui
tree · dart_tui
Tree demo

TreeModel

PropertyTypeDescription
rootTreeNodeRoot node. Each node has a label, isExpanded flag and children.
cursorintIndex into the flattened visible node list.
heightintVisible rows before scrolling. Defaults to 20.
stylesTreeStylesStyling for the cursor, labels and connectors.

Keybindings

↑ / k, ↓ / jMove cursor
→ / lExpand node
← / hCollapse node
enter / spaceToggle node

Related