tui-treelistview
A tree-list widget for Ratatui.
The widget focuses on interaction with tree data: browsing, navigation, filtering, sorting, marks, and editing workflows rather than passive rendering alone.

This widget is the open part of a closed-source project, so some features may be highly specialized.
How it works
The widget is split into four layers:
TreeModelprovides roots, child states, and a data revision. Your application owns the data.TreeQuerydescribes filtering, sorting, root visibility, and selection fallback.TreeListViewStatestores selection, expanded nodes, marks, scroll positions, and caches.TreeListViewrenders the current projection as a Ratatui table.
Typical usage:
- Implement
TreeModelfor your data. - Provide a label renderer and a
TreeColumnSet. - Keep
TreeListViewStatein the application state. - Handle actions or keys and render
TreeListVieweach frame.
TreeModel assumes a real forest: IDs are stable and unique, nodes have one parent, cycles are not
allowed, and revision() changes after relevant model updates.
Features
- Generic stable node IDs and multiple roots.
- Lazy
UnloadedandLoadingchild states. - Filtering, sibling sorting, and stable-ID selection.
- Dynamic columns, horizontal scrolling, and viewport row virtualization.
- Typed view/edit actions, marks, snapshots, and hit testing.
- Iterative traversal for very deep trees.
Usage
Add the crate from crates.io:
[]
= "0.2"
Optional features:
keymap— Crossterm key bindings.serde— serialization ofTreeListViewSnapshot.
The crate does not select a Ratatui backend. Editing types are always available.
Examples
Most examples render into an in-memory buffer and exit immediately. The demo is interactive and keeps edits in memory.
Demo keys: arrows or hjkl navigate, Enter toggles, E/C expand or collapse all,
Shift+Up/Down reorder, a adds, e renames, d detaches, D deletes, y/p yank and paste,
Tab changes columns, Ctrl+Left/Right scrolls horizontally, and q/Esc exits.
Benchmarks
The Criterion suite covers balanced, deep, wide, and multi-root trees; projection cache hits and rebuilds; filtering and sorting; marks and deep selection; indexed-tree validation; and full, virtualized, and horizontally scrolled rendering.
The --test mode executes every scenario once and is useful as a fast benchmark smoke test.