pub fn navigation_bar<F>(state: NavigationBarState, scope_config: F)where
F: FnOnce(&mut NavigationBarScope<'_>),Expand description
§navigation_bar
Material navigation bar with active indicator and icon/label pairs.
§Usage
Place at the bottom of the app to switch between 3–5 primary destinations.
§Parameters
state— seeNavigationBarStateto track which destination is active.scope_config— closure that registers items viaNavigationBarScope.
§Examples
use tessera_ui_basic_components::navigation_bar::{
NavigationBarItemBuilder, NavigationBarState, navigation_bar,
};
let state = NavigationBarState::new(0);
navigation_bar(state.clone(), |scope| {
scope.item(
NavigationBarItemBuilder::default()
.label("Home")
.build()
.unwrap(),
);
scope.item(
NavigationBarItemBuilder::default()
.label("Search")
.build()
.unwrap(),
);
});
assert_eq!(state.selected(), 0);
state.select(1);
assert_eq!(state.selected(), 1);
assert_eq!(state.previous_selected(), 0);