pub fn button_group<State: 'static, F: Fn(&mut State, usize) + 'static>(
labels: impl IntoIterator<Item = impl Into<String>>,
selected: usize,
on_select: F,
) -> ButtonGroupView<State>Expand description
Create a single-select connected group with the given member labels,
the currently-selected index, and an on_select callback fired (with the
tapped member’s index) on release inside a member.
A selected index outside 0..labels.len() simply highlights no member
(there is no panic); feed a valid index to show a selection.
This is the module’s pre-rework constructor and keeps its pre-rework
meaning: ButtonGroupType::Connected, and an on_select that always
reports the tapped index (never a deselect None). Reach for
button_group_actions for the full port — icons, multi-select,
densities, direction, and overflow — whose defaults follow the reference’s
(Standard) instead.