ratatui_toolkit/primitives/tree_view/node_state/mod.rs
1//! Node state information for rendering.
2
3/// State information for rendering a node.
4///
5/// Provides context about a node's current state during rendering,
6/// allowing the render function to customize the display based on
7/// selection, expansion, and position in the tree.
8///
9/// # Example
10///
11/// ```rust
12/// use ratatui_toolkit::tree_view::NodeState;
13///
14/// let state = NodeState {
15/// is_selected: true,
16/// is_expanded: false,
17/// level: 0,
18/// has_children: true,
19/// path: vec![0],
20/// };
21/// ```
22#[derive(Debug, Clone)]
23pub struct NodeState {
24 /// Whether this node is selected
25 pub is_selected: bool,
26 /// Whether this node is expanded
27 pub is_expanded: bool,
28 /// Depth level in the tree (0 = root)
29 pub level: usize,
30 /// Whether this node has children
31 pub has_children: bool,
32 /// Path to this node (indices from root)
33 pub path: Vec<usize>,
34}