Skip to content

Styling

B.Cem edited this page Jul 28, 2026 · 1 revision

Styling

dialogStyle works like SwiftUI's buttonStyle: apply it to the content inside the peekDialog closure.

.peekDialog(isPresented: $showDialog) {
    Text("Hello")
        .padding()
        .dialogStyle(.glassRegular)   // ✅ inside
}

Applying it outside the closure has no effect — see Common Mistakes.


Built-in styles

Style Notes
(default) Material background, rounded rectangle — used when you omit .dialogStyle
.plain No background; you style the content yourself
.glassRegular Glass effect (iOS 26+)
.glassClear Clear glass (iOS 26+)

Glass

.peekDialog(isPresented: $showDialog) {
    Text("Glass")
        .padding()
        .dialogStyle(.glassRegular)
}

Plain

.plain keeps the max-width frame but strips the default material background so you own the look:

.peekDialog(isPresented: $showToast, dismissDelay: .short) {
    Text("Copied to clipboard")
        .foregroundColor(.white)
        .padding(.horizontal, 20)
        .padding(.vertical, 12)
        .background {
            RoundedRectangle(cornerRadius: 20)
                .fill(Color.black.opacity(0.8))
        }
        .dialogStyle(.plain)
}

Going further

Need something reusable across the app? → Custom Styles

Clone this wiki locally