-
Notifications
You must be signed in to change notification settings - Fork 9
Component Tree
MeowLynxSea edited this page Jun 13, 2026
·
8 revisions
A tree view. Carries the TreeData model and the current expanded / selected ids. Children are tree_item(...) rows; the renderer draws the connector lines and indent guides.
use yororen_ui::headless::tree::tree;
use yororen_ui::headless::tree::TreeData;
use yororen_ui::headless::tree::node_id;use yororen_ui::headless::tree::{tree, TreeData, node_id};
use yororen_ui::headless::tree_item::tree_item;
let data = {
let mut d = TreeData::new();
let root = node_id("root");
let docs = node_id("docs");
let readme = node_id("readme");
d.add(root.clone(), docs.clone(), "docs");
d.add(docs.clone(), readme.clone(), "README.md");
d
};
tree("files", cx)
.data(data)
.expanded(node_id("docs"))
.selected(node_id("readme"))
.render(cx)| Method | Purpose |
|---|---|
data(d) |
The TreeData model. |
expanded(id) |
The currently expanded node id. Pass an id you got from node_id("…"). |
selected(id) |
The currently selected node id. |
The body of the tree is built by nested tree_item(...) calls as children of the rendered tree.
- Factory takes
(id, _cx). - No state entity — the parent view owns the
expanded/selectedids. -
node_id(s)is a helper that interns a&str(orString) into aTreeNodeId. It is cheap to call repeatedly. -
.render(cx)returnsStateful<Div>.
TreeItem, ListItem, VirtualRow
Yororen UI v0.3.0 · repository · Apache-2.0 · This wiki documents Yororen UI v0.3.0.
This wiki documents Yororen UI v0.3.0 — the headless-core, swappable-renderer build.