Skip to main content
239

Search Lumen

Find components, APIs, guides, and recipes.

GitHub
Themes
Apple docs
FeedbackApple

Toast viewport

Stack timed notifications above the app inside the safe area.

Public APILumenToastViewportApple / SwiftUISwift product: LumenUI

Apple availability

Supported native targets

Import LumenUI in the target that uses this component. iPad support follows the iOS package baseline and uses native iPad layout behavior.

iPhone · iOS 16+iPad · iPadOS 16+Mac · macOS 13+Apple TV · tvOS 16+Apple Vision · visionOS 1+Apple Watch · watchOS 9+

Native example

Use Toast viewport

Render one viewport at the app root and show toasts through its queue. Keep messages short and actions optional.

Toast viewport rendered in the iPhone simulator Lumen playground
Captured exampleiPhone simulatorView dark appearance
swift
import LumenUI
import SwiftUI

struct SyncScreen: View {
    @StateObject private var toasts = LumenToastQueue()

    var body: some View {
        VStack(spacing: LumenSpacing.md) {
            LumenButton("Save") {
                toasts.show("Changes saved", description: "Your edits are live.", variant: .success)
            }
            LumenButton("Pause sync", intent: .outline) {
                toasts.show("Sync paused", variant: .warning, duration: 0,
                            action: LumenToastAction("Resume") {
                                toasts.show("Sync resumed", variant: .success)
                            })
            }
        }
        .frame(maxWidth: .infinity, maxHeight: .infinity)
        .lumenToastViewport(toasts, placement: .bottomRight)
    }
}
Apple
An app-wide toast queue shown in the bottom-right corner, with a success toast and a persistent warning that offers a Resume action.

Reference

Public API

The primary shared and platform-specific options exposed by LumenToastViewport.

APIValues or typeDefaultDescription
placement / maxCount / durationscreen edge / visible toasts / auto-dismissbottom-center / 3 / 5000 msRender one viewport at the app root and show toasts through its queue.

Native behavior

Design and accessibility

When to use it

Render one viewport at the app root and show toasts through its queue. Keep messages short and actions optional.

Accessibility

Toasts announce by tone, pause while touched, and keep a named dismiss button.

Shared component

Available on other platforms

React NativeAndroid / Compose Web
Apple docsSwiftUI package