GlassFloatingButton
Floating action placed inside the safe area, clear of the keyboard.
- System control
- iOS 26 · iPadOS 26 · macOS 26
- Version 1.1.0
glass-floating-button
Drawn by the system. GlassKit configures it and leaves the glass to the system.
CaptureInstallation
spglass add glass-floating-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-floating-button |
|---|---|
| Module | SPGlassComponents |
| Kind | native-wrapper — a prominent system glass button placed by an overlay inside the safe area |
| Platforms | iOS 26, iPadOS 26, macOS 26 |
| Example | Examples/Gallery/Buttons/GlassFloatingButtonExample.swift |
Minimal usage
List(notes) { NoteRow($0) }
.glassFloatingButton("New note", systemImage: "plus") { compose() }Variants
| Variant | Use |
|---|---|
| Icon only (default) | Circular button; the title is the accessibility label. |
isExtended: true | Capsule showing the symbol and the title. |
position | .bottomTrailing (default), .bottomLeading, .bottomCenter, .topTrailing, .topLeading; leading and trailing follow the layout direction. |
Parameters
| Parameter | Type | Default | Meaning |
|---|---|---|---|
titleKey | LocalizedStringKey | — | Title and accessibility label. |
systemImage | String | — | SF Symbol name. |
position | GlassFloatingPosition | .bottomTrailing | Corner or edge inside the safe area. |
isExtended | Bool | false | Shows the title next to the symbol. |
isPresented | Bool | true | Hides the button without removing the modifier. |
action | @MainActor () -> Void | — | Called on activation. |
States
Appearing and disappearing use a scale and fade, or a fade alone with Reduce Motion. Pressed and focused states are drawn by the system.
Advanced example
ScrollView { content }
.glassFloatingButton("Compose", systemImage: "square.and.pencil", position: .bottomCenter, isExtended: true, isPresented: !isSearching) {
compose()
}Accessibility
- The button always has a text label, visible or not.
- It is laid out inside the safe area: it stays clear of the home indicator, of bars and of the software keyboard.
- The hit target meets the platform minimum.
- Do not make it the only way to reach an action: offer the same command in a menu or toolbar for keyboard and Switch Control users.
Limits
- One floating button per screen. Several compete with each other and with the tab bar.
- It floats over content and can hide the last row of a list; add bottom content margin where that matters.
GlassFloatingButtoncan also be used directly when a custom placement is needed.
Example
import SwiftUI
import SPGlassKit
public struct GlassFloatingButtonExample: GlassExample {
public static let componentID = "glass-floating-button"
@State private var notes = ["Groceries", "Reading list", "Trip ideas"]
@State private var isExtended = true
public init() {}
public var body: some View {
List {
Toggle("Show title", isOn: $isExtended)
ForEach(notes, id: \.self) { Text($0) }
}
.frame(minHeight: 280)
.glassFloatingButton("New note", systemImage: "plus", position: .bottomTrailing, isExtended: isExtended) {
notes.append("Note \(notes.count + 1)")
}
}
}
#Preview("GlassFloatingButton") { GlassFloatingButtonExample() }
Registry entry
| Identifier | glass-floating-button |
|---|---|
| Version | 1.1.0 |
| Depends on | glass-components-support, glass-foundation |
| Frameworks | SwiftUI |
| Public symbols | GlassFloatingPosition, GlassFloatingButton |
| Licence | MIT |
| Manifest | manifest.json |
Files
Components/Buttons/GlassFloatingButton.swift5511 bytes · sha256 abfadc1bbe56…