pub fn SegmentedButton(_: BaseSegmentedButtonProps) -> Element
Expand description
SegmentedButton is used to group a set of ButtonSegments together.
§Styling
Inherits the outline SegmentedButtonTheme
theme.
§Example
fn app() -> Element {
let mut selected = use_signal(|| HashSet::from([1]));
rsx!(
rect {
padding: "8",
spacing: "8",
SegmentedButton {
for i in 0..2 {
ButtonSegment {
key: "{i}",
selected: selected.read().contains(&i),
onpress: move |_| {
if selected.read().contains(&i) {
selected.write().remove(&i);
} else {
selected.write().insert(i);
}
},
label {
"Option {i}"
}
}
}
}
}
)
}