Skip to content
Snooze Toast preview
Rendered from the SwiftUI source on this page.

Snooze Toast

From syxUI — written for both platforms, not translated between them.

A dark toast with undo.

Banners · SwiftUI · iOS 17

  • banners
  • swiftui

The actual source

ToastSnooze.swift
// Snooze Toast · syxUI · https://syxui.dev/components/bt-snooze
// Free in any project. Keep this line and credit syxUI where a person can read it.

import SwiftUI

func darkToast(_ icon: String, _ msg: String, action: String? = nil, tint: Color = .white) -> some View {
    HStack(spacing: 12) {
        Image(systemName: icon).font(.system(size: 16)).foregroundStyle(tint)
        Text(msg).font(.system(size: 14, weight: .medium)).foregroundStyle(.white)
        Spacer(minLength: 12)
        if let action { Text(action).font(.system(size: 14, weight: .semibold)).foregroundStyle(Color(red: 0.45, green: 0.72, blue: 1.0)) }
    }.padding(.horizontal, 16).padding(.vertical, 13).frame(width: 320).background(Color(red: 0.15, green: 0.15, blue: 0.17), in: RoundedRectangle(cornerRadius: 14, style: .continuous)).shadow(color: .black.opacity(0.15), radius: 12, y: 5)
}

struct ToastSnooze: View { var body: some View { darkToast("clock", "Notification snoozed", action: "Undo") } }
iOS 17 · No dependencies

Dependencies

SwiftUI
No external dependencies

Requires iOS 17