Skip to main content

navigation_rail

Function navigation_rail 

Source
pub fn navigation_rail() -> NavigationRailBuilder
Expand description

Navigation rail that switches between collapsed and expanded layouts for primary destinations.

§Usage

Use for tablet and desktop layouts with 3-7 primary destinations.

§Parameters

  • expanded — whether the rail renders in expanded (icon-start) mode.
  • content — item declarations rendered in the rail.
  • header — optional header rendered above items.

§Examples

use tessera_components::navigation_rail::{navigation_rail, navigation_rail_item};
use tessera_ui::{remember, tessera};

#[tessera]
fn demo() {
    let selected = remember(|| 0usize);
    navigation_rail().expanded(true).content(move |rail| {
        navigation_rail_item(rail)
            .label("Home")
            .selected(selected.get() == 0)
            .on_click(move || selected.set(0));
    });
}