GlassIconButton
Symbol-only glass button with a mandatory accessibility label and a full-size hit target.
- System control
- iOS 26 · iPadOS 26 · macOS 26
- Version 1.1.0
glass-icon-button
Drawn by the system. GlassKit configures it and leaves the glass to the system.
CaptureInstallation
spglass add glass-icon-buttonCopies the sources and their dependencies into your project. Set up the CLI.
.package(url: "https://git.spboucher.ai/sp-glasskit.git", from: "1.1.0")
import SPGlassKit| Identifier | glass-icon-button |
|---|---|
| Module | SPGlassComponents |
| Kind | native-wrapper — a system glass button with a circular border shape |
| Platforms | iOS 26, iPadOS 26, macOS 26 |
| Example | Examples/Gallery/Buttons/GlassIconButtonExample.swift |
Minimal usage
GlassIconButton(systemImage: "square.and.arrow.up", accessibilityLabel: "Share") { share() }Variants
| Variant | Use |
|---|---|
.regular | Secondary actions in toolbars and over content. |
.prominent | The selected or main action of a group. |
role: .destructive | Deletion; tinted with the theme's destructive colour. |
Parameters
| Parameter | Type | Default | Meaning |
|---|---|---|---|
systemImage | String | — | SF Symbol name. |
accessibilityLabel | LocalizedStringKey | — | Required. Read by VoiceOver, shown as the tooltip on macOS, used by Voice Control. |
label | Text | — | Alternative to accessibilityLabel when the text is already a Text. |
variant | GlassButtonVariant | .regular | Visual weight. |
role | ButtonRole? | nil | System role. |
size | GlassControlSize | .regular | Control size. |
action | @MainActor () -> Void | — | Called on activation. |
States
Idle, pressed, focused and disabled (.disabled(_:)) are drawn by the system. There is no loading state: replace the symbol or show progress elsewhere.
Advanced example
GlassIconButton(
systemImage: isFavourite ? "star.fill" : "star",
accessibilityLabel: isFavourite ? "Remove from favourites" : "Add to favourites",
variant: isFavourite ? .prominent : .regular
) { isFavourite.toggle() }
.keyboardShortcut("d", modifiers: .command)Accessibility
- A label is mandatory in the initialiser; a symbol alone is never the accessible name.
- The tappable area is at least 44 × 44 points on iOS and iPadOS, and 24 × 24 on macOS, at every size.
- The label is also the tooltip on macOS (
.help). - State must not rely on the symbol colour alone: change the symbol or the label, as in the example.
Limits
- The symbol cannot be rotated or animated through this component; components that need that draw their own glass circle.
- The glass is drawn by the system and cannot be configured.
Example
import SwiftUI
import SPGlassKit
public struct GlassIconButtonExample: GlassExample {
public static let componentID = "glass-icon-button"
@State private var isFavourite = false
public init() {}
public var body: some View {
HStack(spacing: 16) {
GlassIconButton(systemImage: "square.and.arrow.up", accessibilityLabel: "Share") {}
GlassIconButton(
systemImage: isFavourite ? "star.fill" : "star",
accessibilityLabel: isFavourite ? "Remove from favourites" : "Add to favourites",
variant: .prominent
) { isFavourite.toggle() }
GlassIconButton(systemImage: "trash", accessibilityLabel: "Delete", role: .destructive, size: .small) {}
GlassIconButton(systemImage: "ellipsis", accessibilityLabel: "More", size: .large) {}
}
.padding()
}
}
#Preview("GlassIconButton") { GlassIconButtonExample() }
Registry entry
| Identifier | glass-icon-button |
|---|---|
| Version | 1.1.0 |
| Depends on | glass-components-support, glass-foundation |
| Frameworks | SwiftUI |
| Public symbols | GlassIconButton, GlassIconButtonMetrics |
| Licence | MIT |
| Manifest | manifest.json |
Files
Components/Buttons/GlassIconButton.swift4532 bytes · sha256 6f3eea07f593…