ratatui_toolkit/primitives/tree_view/tree_view_ref/methods/
highlight_style.rs

1//! TreeViewRef::highlight_style method.
2
3use ratatui::style::Style;
4
5use crate::primitives::tree_view::tree_view_ref::TreeViewRef;
6
7impl<'a, 'b, T> TreeViewRef<'a, 'b, T> {
8    /// Sets the highlight style for selected rows (full-width background).
9    ///
10    /// # Arguments
11    ///
12    /// * `style` - The style to apply to selected rows.
13    ///
14    /// # Returns
15    ///
16    /// Self for method chaining.
17    ///
18    /// # Example
19    ///
20    /// ```rust
21    /// use ratatui::style::{Color, Style};
22    /// use ratatui_toolkit::tree_view::{TreeNode, TreeViewRef};
23    ///
24    /// let nodes = vec![TreeNode::new("Item")];
25    /// let tree = TreeViewRef::new(&nodes)
26    ///     .highlight_style(Style::default().bg(Color::Blue));
27    /// ```
28    pub fn highlight_style(mut self, style: Style) -> Self {
29        self.highlight_style = Some(style);
30        self
31    }
32}