Skip to main content

app_header

Function app_header 

Source
pub fn app_header<'a, Message, MenuId, MenuItemId, F>(
    title: &'a str,
    menus: Vec<Menu<MenuId, MenuItemId>>,
    on_menu_action: &'a F,
    active_menu_id: Option<&MenuId>,
    end_controls: Option<Element<'a, Message>>,
    direction: LayoutDirection,
) -> Element<'a, Message>
where Message: Clone + 'a, MenuId: Clone + Debug + PartialEq + 'a, MenuItemId: Clone + Debug + 'a, F: Fn(MenuAction<MenuId, MenuItemId>) -> Message + 'a,
Expand description

Build an application header.

  • title — the app name, rendered bold at the start edge.
  • menus — drop-down menus (File / View / …). Rendered immediately after the title. Pass vec![] for a title-only header.
  • on_menu_action — maps MenuAction events into your message type.
  • active_menu_id — the currently-open menu, if any. Needed so the menu widget can render its dropdown items. Usually a field on your application state.
  • end_controls — optional element pinned to the end edge (right under LTR, left under RTL). Typically status indicators, theme toggles, etc.
  • direction — application’s reading direction.