Fusuma

Components / Composite

toggle_group

Joined buttons of which any number is on (bold, italic, underline); pressing one sends on_toggle(index) and the app flips it in on.

Try it

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

Live: Bars, where toggle_group is usedOpen full size

Also on this pagetop_bartoolbaricon_badgefabsearch_barmarksnavigation_barchip_groupbutton_groupavatar_group

Joined buttons of which any number is on (bold, italic, underline); pressing one sends on_toggle(index) and the app flips it in on.

Signature

pub const fn toggle_group<'a, M>( labels: &'a [&'a str], on: u32, on_toggle: fn(usize) -> M, ) -> Choices<'a, M>

Example

use fusuma::{marks, toggle_group};
let (bold, italic) = (true, false);
let view = toggle_group(&["Bold", "Italic"], marks(&[bold, italic]), |i| i);
let built = fusuma::doc::built::<usize, _>(&view);
assert_eq!(built.texts(), ["Bold", "Italic"]);

All components · Source