Skip to main content

navigation_drawer_item

Function navigation_drawer_item 

Source
pub fn navigation_drawer_item() -> NavigationDrawerItemBuilder
Expand description

Show a selectable destination with an optional icon and trailing badge.

§Usage

Switch between primary destinations while announcing the current selection.

§Parameters

  • modifier — additional layout and semantics.
  • label — destination name.
  • selected — whether this is the current destination.
  • enabled — whether pointer and keyboard activation are available.
  • on_click — destination activation callback.
  • icon — optional 24dp leading icon.
  • badge — optional trailing count or status.

§Examples

use tessera_components::navigation_drawer::navigation_drawer_item;
use tessera_ui::{remember, tessera};

#[tessera]
fn destination() {
    let selected = remember(|| false);
    navigation_drawer_item()
        .label("Saved")
        .selected(selected.get())
        .on_click(move || selected.set(true));
}