Skip to content
Destructive Actions preview
Rendered from the SwiftUI source on this page.

Destructive Actions

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

A self-contained destructive actions — SwiftUI, styled from system tokens.

Buttons · SwiftUI · iOS 17

  • buttons
  • swiftui

The actual source

DestructiveActions.swift
// Destructive Actions · syxUI · https://syxui.dev/components/button-destructive
// Free in any project. Keep this line and credit syxUI where a person can read it.

import SwiftUI

// Destructive action pair
struct DestructiveActions: View {
    var body: some View {
        VStack(spacing: 10) {
            Text("Delete account").font(.system(size: 16, weight: .semibold)).foregroundStyle(.white)
                .frame(maxWidth: .infinity, minHeight: 52).background(Color(red: 0.86, green: 0.20, blue: 0.18), in: Capsule())
            Text("Remove from list").font(.system(size: 16, weight: .semibold)).foregroundStyle(Color(red: 0.86, green: 0.20, blue: 0.18))
                .frame(maxWidth: .infinity, minHeight: 52).background(Color(red: 0.86, green: 0.20, blue: 0.18).opacity(0.10), in: Capsule())
            Text("Cancel").font(.system(size: 16, weight: .semibold)).foregroundStyle(.secondary).frame(maxWidth: .infinity, minHeight: 52)
        }
    }
}
iOS 17 · No dependencies

Dependencies

SwiftUI
No external dependencies

Requires iOS 17