Skip to main content

navigation_bar

Function navigation_bar 

Source
pub fn navigation_bar() -> NavigationBarBuilder
Expand description

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

  • content — item declarations rendered inside the bar.
  • icon_position — icon placement; defaults to adapting at 600dp.

§Examples

use tessera_components::navigation_bar::{navigation_bar, navigation_bar_item};
use tessera_ui::{remember, tessera};

#[tessera]
fn demo() {
    let selected = remember(|| 0usize);
    navigation_bar().content(move |position| {
        navigation_bar_item().icon_position(position)
            .label("Home")
            .selected(selected.get() == 0)
            .on_click(move || selected.set(0));
        navigation_bar_item().icon_position(position)
            .label("Search")
            .selected(selected.get() == 1)
            .on_click(move || selected.set(1));
    });
}