ratatui_toolkit/primitives/tree_view/tree_view_ref/methods/icons.rs
1//! TreeViewRef::icons method.
2
3use crate::primitives::tree_view::tree_view_ref::TreeViewRef;
4
5impl<'a, 'b, T> TreeViewRef<'a, 'b, T> {
6 /// Sets custom expand/collapse icons.
7 ///
8 /// # Arguments
9 ///
10 /// * `expand` - The icon to show for collapsed nodes.
11 /// * `collapse` - The icon to show for expanded nodes.
12 ///
13 /// # Returns
14 ///
15 /// Self for method chaining.
16 ///
17 /// # Example
18 ///
19 /// ```rust
20 /// use ratatui_toolkit::tree_view::{TreeNode, TreeViewRef};
21 ///
22 /// let nodes = vec![TreeNode::new("Item")];
23 /// let tree = TreeViewRef::new(&nodes)
24 /// .icons("+", "-");
25 /// ```
26 pub fn icons(mut self, expand: &'a str, collapse: &'a str) -> Self {
27 self.expand_icon = expand;
28 self.collapse_icon = collapse;
29 self
30 }
31}