Repository Public MIT
1# GlassFloatingButton23| | |4|---|---|5| Identifier | `glass-floating-button` |6| Module | `SPGlassComponents` |7| Kind | `native-wrapper` — a prominent system glass button placed by an overlay inside the safe area |8| Platforms | iOS 26, iPadOS 26, macOS 26 |9| Example | `Examples/Gallery/Buttons/GlassFloatingButtonExample.swift` |1011## Minimal usage1213```swift14List(notes) { NoteRow($0) }15 .glassFloatingButton("New note", systemImage: "plus") { compose() }16```1718## Variants1920| Variant | Use |21|---|---|22| Icon only (default) | Circular button; the title is the accessibility label. |23| `isExtended: true` | Capsule showing the symbol and the title. |24| `position` | `.bottomTrailing` (default), `.bottomLeading`, `.bottomCenter`, `.topTrailing`, `.topLeading`; leading and trailing follow the layout direction. |2526## Parameters2728| Parameter | Type | Default | Meaning |29|---|---|---|---|30| `titleKey` | `LocalizedStringKey` | — | Title and accessibility label. |31| `systemImage` | `String` | — | SF Symbol name. |32| `position` | `GlassFloatingPosition` | `.bottomTrailing` | Corner or edge inside the safe area. |33| `isExtended` | `Bool` | `false` | Shows the title next to the symbol. |34| `isPresented` | `Bool` | `true` | Hides the button without removing the modifier. |35| `action` | `@MainActor () -> Void` | — | Called on activation. |3637## States3839Appearing and disappearing use a scale and fade, or a fade alone with Reduce Motion. Pressed and focused states are drawn by the system.4041## Advanced example4243```swift44ScrollView { content }45 .glassFloatingButton("Compose", systemImage: "square.and.pencil", position: .bottomCenter, isExtended: true, isPresented: !isSearching) {46 compose()47 }48```4950## Accessibility5152- The button always has a text label, visible or not.53- It is laid out inside the safe area: it stays clear of the home indicator, of bars and of the software keyboard.54- The hit target meets the platform minimum.55- 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.5657## Limits5859- One floating button per screen. Several compete with each other and with the tab bar.60- It floats over content and can hide the last row of a list; add bottom content margin where that matters.61- `GlassFloatingButton` can also be used directly when a custom placement is needed.62