Skip to main content

segmented_button

Function segmented_button 

Source
pub fn segmented_button<State: 'static, T: PartialEq + Clone + 'static, F: Fn(&mut State, Vec<T>) + 'static>(
    segments: impl IntoIterator<Item = Segment<T>>,
    selected: impl IntoIterator<Item = T>,
    on_selection_changed: F,
) -> SegmentedButtonView<State, T>
Expand description

Create a segmented button from segments (2-5, debug_assert!-checked — see MIN_SEGMENTS/MAX_SEGMENTS), reflecting selected (the currently-confirmed selection). Single-select by default; call SegmentedButtonView::multi_select(true) to allow more than one member selected at once. on_selection_changed fires with the requested next selection on release inside a member — see the module docs’ Selection semantics section.