GlassSplitButton
| Identifier | glass-split-button |
| Module | SPGlassComponents |
| Kind | native-wrapper — Menu with a primary action on macOS; a glass button and a glass menu button on iOS and iPadOS |
| Platforms | iOS 26, iPadOS 26, macOS 26 |
| Example | Examples/Gallery/Buttons/GlassSplitButtonExample.swift |
Minimal usage
swift
GlassSplitButton("Send", systemImage: "paperplane") {
send()
} menu: {
Button("Send later…") { schedule() }
Button("Save draft") { saveDraft() }
}Variants
| Platform | Form |
|---|---|
| macOS | The system split button: Menu(content:label:primaryAction:). |
| iOS, iPadOS | Two glass buttons in one glass container: the action, and a circular menu button. Each is its own accessibility element and hit target. |
variant and size behave as for GlassButton.
Parameters
| Parameter | Type | Default | Meaning |
|---|---|---|---|
titleKey |
LocalizedStringKey |
— | Title of the primary action. |
systemImage |
String? |
nil |
SF Symbol of the primary action. |
variant |
GlassButtonVariant |
.regular |
Visual weight of both parts. |
size |
GlassControlSize |
.regular |
Control size. |
menuAccessibilityLabel |
LocalizedStringKey? |
"More actions" (localised) | Name of the menu part. |
action |
@MainActor () -> Void |
— | Primary action. |
menu |
@ViewBuilder |
— | Menu content: buttons, sections, dividers. |
States
Pressed, focused and menu-open states are drawn by the system. Disable the whole control with .disabled(_:); disable single menu items on the items themselves.
Advanced example
swift
GlassSplitButton("Export", systemImage: "square.and.arrow.up", variant: .prominent, menuAccessibilityLabel: "Export options") {
export(.pdf)
} menu: {
Section("Format") {
Button("PDF") { export(.pdf) }
Button("PNG") { export(.png) }
}
Button("Export settings…") { showSettings() }
}Accessibility
- The action and the menu are two separate, labelled elements on iOS and iPadOS.
- The menu part has its own name, "More actions" by default, in English and French.
- Both parts meet the minimum hit target.
- Menu items are standard buttons: VoiceOver, keyboard and Switch Control work as in any system menu.
Limits
- On macOS the appearance is the system's split button and does not use a separate circular menu button.
- Put the most frequent action first: the menu is for alternatives, not for the main path.