GlassSheet
| Identifier | glass-sheet |
| Module | SPGlassComponents |
| Kind | native-wrapper — the system .sheet; the system draws the sheet and its glass |
| Platforms | iOS 26, iPadOS 26, macOS 26 |
| Example | Examples/Gallery/Containers/GlassSheetExample.swift |
Minimal usage
swift
.glassSheet(isPresented: $showsFilters, title: "Filters") {
FiltersForm()
}Variants
| Variant | Use |
|---|---|
isPresented: |
Presentation driven by a Boolean. |
item: |
Presentation driven by an optional Identifiable value. |
.standard |
Full height, drag indicator, close button. |
.halfAndFull |
Rests at half height, can be pulled to full height. |
| Custom detents | .medium, .large, .fraction(0.1...1), .height(≥ 44). |
Parameters
| Parameter | Type | Default | Meaning |
|---|---|---|---|
isPresented / item |
Binding<Bool> / Binding<Item?> |
— | Presentation state. |
title |
LocalizedStringKey? |
nil |
Title of the sheet's bar. |
configuration |
GlassSheetConfiguration |
.standard |
Options below. |
onDismiss |
(@MainActor () -> Void)? |
nil |
Called after dismissal. |
content |
@ViewBuilder |
— | Content of the sheet. |
GlassSheetConfiguration:
| Field | Default | Meaning |
|---|---|---|
detents |
[.large] |
Resting heights; an empty list means full height. Out-of-range values are normalised. |
showsDragIndicator |
true |
Drag indicator visibility. |
showsCloseButton |
true |
System close button (ButtonRole.close) in the bar. |
isInteractiveDismissDisabled |
false |
Blocks swipe-to-dismiss; the close button still works. |
scrollDismissesKeyboard |
true |
Scrolling inside the sheet dismisses the keyboard interactively. |
States
Presented or not, owned by the host. The current detent is managed by the system.
Advanced example
swift
.glassSheet(item: $editedContact, title: "Edit contact",
configuration: GlassSheetConfiguration(detents: [.fraction(0.45), .large], isInteractiveDismissDisabled: hasChanges)) { contact in
ContactForm(contact: contact)
.toolbar {
ToolbarItem(placement: .confirmationAction) { Button("Save") { save(contact) } }
}
}Accessibility
- The close button uses the system close role: the system provides its symbol and its localised label, and it sits in the cancellation placement where assistive technologies expect it.
- The title is a navigation title, announced as a heading.
- Keyboard avoidance, focus trapping and the Escape key are the system's.
- With
isInteractiveDismissDisabled, keepshowsCloseButtonon (or provide your own way out) so the sheet can always be left.
Limits
- When a title or the close button is requested, the content is wrapped in a
NavigationStackso that it can also add toolbar items. Passtitle: nilandshowsCloseButton: falseto present the content bare. - GlassKit adds no background: at partial height the system draws the Liquid Glass sheet. Do not add a glass surface inside.
- Detents have no effect on macOS, where sheets are sized by their content.
- The mapping to
PresentationDetentis tested; the presentation itself was compiled for iOS and macOS but not exercised in a running application by the automated tests.