pub fn button_groups() -> ButtonGroupsBuilderExpand description
§button_groups
Button groups organize buttons and add interactions between them.
§Usage
Used for grouping related actions.
§Parameters
size— size of the button group.style— visual style of the button group.variant— color style of the buttons: filled (default), tonal, outlined, or elevated. Text buttons have no container treatment and use filled.presentation_states— optional static visual interaction per item, in visual order, without changing input or focus. Pressed items also show the pressed shape.shape_style— round or square resting shapes; defaults to round.expanded_ratio— pressed width expansion in standard groups, clamped to 0–1; defaults to 0.15. Neighbors limit expansion to their content padding. Non-finite values use the default.selection_mode— single or multiple selection; switching to single selection retains the first selected item in visual order.modifier— group sizing, placement, and semantics.state— optional external selection; omitted groups remember their own.enabled— whether the group accepts input.disabled_indices— items that retain selection but cannot be activated.selection_required— prevents removing the final selection; an empty selection chooses the first enabled item when available.child_closures— per-item content builders.on_click_closures— per-item click handlers receiving the new active state after selection has been updated.
§Examples
use tessera_components::{
button_groups::{ButtonGroupsState, button_groups},
text::text,
};
let mut selection = ButtonGroupsState::new();
selection.set_selected(0, true);
assert!(selection.is_selected(0));
selection.clear();
assert!(!selection.is_selected(0));
button_groups().child(
|| {
text("Button 1");
},
|_| {},
);