SP GlassKit1.1.0

GlassButtonGroup

Related glass buttons rendered in one glass container so that they blend consistently.

  • Custom glass
  • iOS 26 · iPadOS 26 · macOS 26
  • Version 1.1.0
  • glass-button-group

Draws its own Liquid Glass surface, with an opaque form when Reduce Transparency is on.

GlassButtonGroup running in SP Glass Studio.Capture
Capture of the component running in SP Glass Studio on the iOS 26.5 simulator. Liquid Glass is rendered by the system; this is an image, not a live preview.

Installation

spglass add glass-button-group

Copies the sources and their dependencies into your project. Set up the CLI.

Swift
.package(url: "https://git.spboucher.ai/sp-glasskit.git", from: "1.1.0")

import SPGlassKit
Identifierglass-button-group
ModuleSPGlassComponents
Kindcustom-glass — a GlassEffectContainer around related glass buttons; it adds no surface of its own
PlatformsiOS 26, iPadOS 26, macOS 26
ExampleExamples/Gallery/Buttons/GlassButtonGroupExample.swift

Minimal usage

Swift
GlassButtonGroup(accessibilityLabel: "Text style") {
    GlassIconButton(systemImage: "bold", accessibilityLabel: "Bold") { toggleBold() }
    GlassIconButton(systemImage: "italic", accessibilityLabel: "Italic") { toggleItalic() }
}

Variants

VariantUse
axis: .horizontalToolbars and inline groups (default).
axis: .verticalMap and canvas controls stacked on an edge.
spacingA step of the theme's spacing scale; also the distance below which neighbouring glass shapes start to blend.

Parameters

ParameterTypeDefaultMeaning
axisAxis.horizontalDirection of the group.
spacingGlassSpacingStep.xsDistance between buttons.
accessibilityLabelLocalizedStringKey?nilName 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.

Example

Complete example (compiled with the package)
import SwiftUI
import SPGlassKit

public struct GlassButtonGroupExample: GlassExample {
    public static let componentID = "glass-button-group"
    @State private var styles: Set<String> = []

    public init() {}

    public var body: some View {
        VStack(spacing: 24) {
            GlassButtonGroup(accessibilityLabel: "Text style") {
                ForEach(["bold", "italic", "underline"], id: \.self) { style in
                    GlassIconButton(
                        systemImage: style,
                        label: Text(style.capitalized),
                        variant: styles.contains(style) ? .prominent : .regular
                    ) {
                        styles.formSymmetricDifference([style])
                    }
                }
            }
            GlassButtonGroup(axis: .vertical, spacing: .sm, accessibilityLabel: "Zoom") {
                GlassIconButton(systemImage: "plus", accessibilityLabel: "Zoom in") {}
                GlassIconButton(systemImage: "minus", accessibilityLabel: "Zoom out") {}
            }
        }
        .padding()
    }
}

#Preview("GlassButtonGroup") { GlassButtonGroupExample() }

Registry entry

Identifierglass-button-group
Version1.1.0
Depends onglass-foundation
FrameworksSwiftUI
Public symbolsGlassButtonGroup
LicenceMIT
Manifestmanifest.json

Files