Cursive Tree
A tree view for the Cursive TUI library.
Nodes can be leaves (no children) or branches (potentially have children) and can have custom data attached to them. Their representation can be stylized with multiple colors and effects.
Supported events:
- Up/Down keys: move selection
- PgUp/PgDown keys: move selection by 10 (configurable)
- Left/Right keys: collapse/expand selected branch node
- Enter key: toggle selected branch node collapse/expand
- "-"/"+" keys: collapse/expand selected branch and all children recursively
- Mouse click on node: select
- Mouse click to the left of the node: toggle branch collapse/expand
The TreeView's data and behavior are backed by a TreeBackend. The nodes are stored and managed by a TreeModel. The model can be populated in advance and can also fetch data from the backend on demand, e.g. when a branch node is expanded.
Check out the examples.
Alternatives
cursive_tree_view seems to be abandoned. It is written for an older version of Cursive but may still work.
License
Like much of the Rust ecosystem, licensed under your choice of either of
Unless you explicitly state otherwise, any contribution intentionally submitted for inclusion in the work by you, as defined in the Apache-2.0 license, shall be dual licensed as above, without any additional terms or conditions.
All code and documentation was written by humans. We do not accept "AI"-generated contributions.