GlassButtonGroup
| Identifier | glass-button-group |
| Module | SPGlassComponents |
| Kind | custom-glass — a GlassEffectContainer around related glass buttons; it adds no surface of its own |
| Platforms | iOS 26, iPadOS 26, macOS 26 |
| Example | Examples/Gallery/Buttons/GlassButtonGroupExample.swift |
Minimal usage
swift
GlassButtonGroup(accessibilityLabel: "Text style") {
GlassIconButton(systemImage: "bold", accessibilityLabel: "Bold") { toggleBold() }
GlassIconButton(systemImage: "italic", accessibilityLabel: "Italic") { toggleItalic() }
}Variants
| Variant | Use |
|---|---|
axis: .horizontal |
Toolbars and inline groups (default). |
axis: .vertical |
Map and canvas controls stacked on an edge. |
spacing |
A step of the theme's spacing scale; also the distance below which neighbouring glass shapes start to blend. |
Parameters
| Parameter | Type | Default | Meaning |
|---|---|---|---|
axis |
Axis |
.horizontal |
Direction of the group. |
spacing |
GlassSpacingStep |
.xs |
Distance between buttons. |
accessibilityLabel |
LocalizedStringKey? |
nil |
Name of the group, read before its buttons. |
content |
@ViewBuilder |
— | The buttons. |
States
The group has no state. Selection is shown by its buttons, for example with the .prominent variant.
Advanced example
swift
GlassButtonGroup(axis: .vertical, spacing: .sm, accessibilityLabel: "Zoom") {
GlassIconButton(systemImage: "plus", accessibilityLabel: "Zoom in") { zoomIn() }
GlassIconButton(systemImage: "minus", accessibilityLabel: "Zoom out") { zoomOut() }
}
.padding()Accessibility
- The group is an accessibility container; give it a label so VoiceOver announces what the buttons have in common.
- Each button keeps its own label, traits and hit target.
- With Reduce Transparency the container is a plain stack and the buttons use the system's opaque treatment.
Limits
- Glass cannot sample other glass: place neighbouring glass controls in one group rather than in separate containers.
- The group does not merge its buttons into a single shape; it lets the system render and blend them together.
- Do not nest a group inside another glass surface.