ratatui_toolkit/primitives/menu_bar/
mod.rs

1//! Menu bar component
2//!
3//! Provides a horizontal menu bar with selectable items.
4
5pub mod constructors;
6pub mod functions;
7pub mod methods;
8pub mod traits;
9
10use ratatui::layout::Rect;
11use ratatui::style::Style;
12
13/// A single menu item
14#[derive(Debug, Clone)]
15pub struct MenuItem {
16    /// The display name of the menu item
17    pub name: String,
18    /// Optional icon to display on the left (can be Nerd Font icon or emoji)
19    pub icon: Option<String>,
20    /// Internal index/value
21    pub value: usize,
22    /// Whether this item is currently selected
23    pub selected: bool,
24    /// Whether the mouse is hovering over this item
25    pub hovered: bool,
26    /// The rendered area of this item
27    pub area: Option<Rect>,
28}
29
30/// A horizontal menu bar with selectable items
31#[derive(Debug, Clone)]
32pub struct MenuBar {
33    pub items: Vec<MenuItem>,
34    pub area: Option<Rect>,
35
36    // Styling
37    pub normal_style: Style,
38    pub selected_style: Style,
39    pub hover_style: Style,
40    pub selected_hover_style: Style,
41}