SP GlassKit1.1.0

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.

GlassIconButton 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-icon-button

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-icon-button
ModuleSPGlassComponents
Kindnative-wrapper — a system glass button with a circular border shape
PlatformsiOS 26, iPadOS 26, macOS 26
ExampleExamples/Gallery/Buttons/GlassIconButtonExample.swift

Minimal usage

Swift
GlassIconButton(systemImage: "square.and.arrow.up", accessibilityLabel: "Share") { share() }

Variants

VariantUse
.regularSecondary actions in toolbars and over content.
.prominentThe selected or main action of a group.
role: .destructiveDeletion; tinted with the theme's destructive colour.

Parameters

ParameterTypeDefaultMeaning
systemImageString—SF Symbol name.
accessibilityLabelLocalizedStringKey—Required. Read by VoiceOver, shown as the tooltip on macOS, used by Voice Control.
labelText—Alternative to accessibilityLabel when the text is already a Text.
variantGlassButtonVariant.regularVisual weight.
roleButtonRole?nilSystem role.
sizeGlassControlSize.regularControl 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

Swift
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

Complete example (compiled with the package)
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

Identifierglass-icon-button
Version1.1.0
Depends onglass-components-support, glass-foundation
FrameworksSwiftUI
Public symbolsGlassIconButton, GlassIconButtonMetrics
LicenceMIT
Manifestmanifest.json

Files