use fission::prelude::*;
// App-owned filesystem labels are data; the parent supplies bound actions.
let item = TreeItem {
id: "src".into(),
icon: None,
label: "src/".into(),
children: vec![TreeItem {
id: "main_rs".into(),
icon: None,
label: "main.rs".into(),
children: vec![],
on_toggle: None,
on_select: Some(open_main_file_action),
}],
on_toggle: None,
on_select: Some(open_src_folder_action),
};
Field | Type | Meaning | Notes / default behavior |
|---|---|---|---|
id | String | Stable item identifier. | Required. Used by TreeView.expanded_ids and selected_id. |
icon | Option<String> | Optional leading icon source. | Defaults to None. |
label | String | Visible node label. | Required. |
children | Vec<TreeItem> | Child widgets nested under this item. | Defaults to an empty list. |
on_toggle | Option<ActionEnvelope> | Intended expansion-toggle action. | Present in the public struct, but see note below. |
on_select | Option<ActionEnvelope> | Action fired when the row is selected. | Defaults to None. |