
Action Toast
From syxUI — written for both platforms, not translated between them.
A toast with a View action.
Banners · SwiftUI · iOS 17
- banners
- swiftui
The actual source
ToastAction.swift
// Action Toast · syxUI · https://syxui.dev/components/bt-action
// 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 ToastAction: View { var body: some View { darkToast("bell.fill", "New comment on your post", action: "View") } }
iOS 17 · No dependencies
Dependencies
- SwiftUI
- No external dependencies
Requires iOS 17


