GlassFloatingButton
| 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
swift
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
swift
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.