Fusuma

Components / Composite

navigation_bar

A bar along the bottom of a screen with one part for each top-level place; current is the place you are in and on_select makes the message from the index that was pressed.

Try it

This is the Bars page of the gallery, running in your browser: navigation_bar is on it, and it is the real widget. Press Run, then use it.

Live: Bars, where navigation_bar is usedOpen full size

Also on this pagetop_bartoolbaricon_badgefabsearch_barmarkstoggle_groupchip_groupbutton_groupavatar_group

A bar along the bottom of a screen with one part for each top-level place; current is the place you are in and on_select makes the message from the index that was pressed. current has the bit of the place you are in set (see marks).

Three to five places fit a phone; on a wide screen turn the same labels into a navigation_rail.

Signature

pub const fn navigation_bar<'a, M>( labels: &'a [&'a str], current: u32, on_select: fn(usize) -> M, ) -> Choices<'a, M>

Example

use fusuma::{marks, navigation_bar};
let place = 1;
let labels = ["Home", "Search", "Library"];
let flags = [place == 0, place == 1, place == 2];
let view = navigation_bar(&labels, marks(&flags), |i| i);
let built = fusuma::doc::built::<usize, _>(&view);
assert_eq!(built.texts(), ["Home", "Search", "Library"]);

All components · Source