Fusuma

Components / Components

segmented

A segmented control: labels, the chosen index, and the message made from the index that was pressed.

Try it

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

Live: Shape, where segmented is usedOpen full size

Also on this pageslider

A segmented control: labels, the chosen index, and the message made from the index that was pressed. The number of labels is part of the shape of the page: it stays the same for as long as the control is shown.

Signature

pub const fn segmented<'a, M>( labels: &'a [&'a str], selected: usize, on_select: fn(usize) -> M, ) -> Segmented<'a, M>

Example

use fusuma::segmented;
let view = segmented(&["Day", "Week", "Month"], 1, |i| i);
let built = fusuma::doc::built::<usize, _>(&view);
assert_eq!(built.texts(), ["Day", "Week", "Month"]);

All components · Source