Fusuma

Components / Components

select

A select over options with selected chosen, the menu open or not.

Try it

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

Live: Pickers, where select is usedOpen full size

Also on this pagecalendartime_pickeraccordionsplit_viewtree_item

A select over options with selected chosen, the menu open or not. on_toggle is what pressing the button sends (the app flips open), on_pick what choosing an option sends (the app stores it and closes), on_dismiss a press outside or Escape (the app closes). The number of options stays the same for as long as it is shown.

Signature

pub const fn select<'a, M>( options: &'a [&'a str], selected: Option<usize>, open: bool, on_toggle: M, on_pick: fn(usize) -> M, on_dismiss: M, ) -> Select<'a, M>

Methods

  • .placeholder(text: &'a str) -> Self — What the button says while nothing is chosen.

Example

use fusuma::select;
let view = select(&["Small", "Medium", "Large"], Some(1), false, 0, |i| i + 10, 0).placeholder("Size");
let built = fusuma::doc::built::<usize, _>(&view);
assert!(built.nodes() > 1);

All components · Source