
Undo Toast
From syxUI — written for both platforms, not translated between them.
A dark toast with an undo action.
Banners · SwiftUI · iOS 17
- banners
- swiftui
The actual source
ToastUndo.swift
// Undo Toast · syxUI · https://syxui.dev/components/bt-undo
// 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 ToastUndo: View { var body: some View { darkToast("arrow.uturn.backward", "1 photo deleted", action: "Undo") } }
iOS 17 · No dependencies
Dependencies
- SwiftUI
- No external dependencies
Requires iOS 17


