Skip to content
Solid Success preview
Rendered from the SwiftUI source on this page.

Solid Success

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

A filled success banner.

Banners · SwiftUI · iOS 17

  • banners
  • swiftui

The actual source

BannerSuccessSolid.swift
// Solid Success · syxUI · https://syxui.dev/components/bt-success-solid
// Free in any project. Keep this line and credit syxUI where a person can read it.

import SwiftUI

let btGreen = Color(red: 0.16, green: 0.66, blue: 0.40)

func solidBanner(_ icon: String, _ color: Color, _ title: String, _ subtitle: String) -> some View {
    HStack(spacing: 12) {
        Image(systemName: icon).font(.system(size: 20)).foregroundStyle(.white)
        VStack(alignment: .leading, spacing: 2) { Text(title).font(.system(size: 14, weight: .semibold)).foregroundStyle(.white); Text(subtitle).font(.system(size: 13)).foregroundStyle(.white.opacity(0.85)) }
        Spacer(minLength: 8)
        Image(systemName: "xmark").font(.system(size: 12, weight: .bold)).foregroundStyle(.white.opacity(0.8))
    }.padding(14).frame(width: 330).background(color, in: RoundedRectangle(cornerRadius: 14, style: .continuous)).shadow(color: color.opacity(0.3), radius: 10, y: 4)
}

struct BannerSuccessSolid: View { var body: some View { solidBanner("checkmark.circle.fill", btGreen, "Order confirmed", "Your order #4829 is on its way.") } }
iOS 17 · No dependencies

Dependencies

SwiftUI
No external dependencies

Requires iOS 17