Skip to content
Loading Button preview
Rendered from the SwiftUI source on this page.

Loading Button

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

A self-contained loading button — SwiftUI, styled from system tokens.

Buttons · SwiftUI · iOS 17

  • buttons
  • swiftui

The actual source

LoadingButtonCard.swift
// Loading Button · syxUI · https://syxui.dev/components/button-loading
// Free in any project. Keep this line and credit syxUI where a person can read it.

import SwiftUI

// Loading button + states
struct LoadingButtonCard: View {
    var body: some View {
        VStack(spacing: 10) {
            HStack(spacing: 8) {
                Circle().trim(from: 0, to: 0.7).stroke(Color(.systemBackground), style: .init(lineWidth: 2, lineCap: .round)).frame(width: 16, height: 16)
                Text("Processing…").font(.system(size: 16, weight: .semibold))
            }.foregroundStyle(.white).frame(maxWidth: .infinity, minHeight: 52).background(Color.primary.opacity(0.6), in: Capsule())
            HStack(spacing: 8) { Image(systemName: "checkmark").font(.system(size: 15, weight: .bold)); Text("Done").font(.system(size: 16, weight: .semibold)) }
                .foregroundStyle(.white).frame(maxWidth: .infinity, minHeight: 52).background(Color.primary, in: Capsule())
            Text("Continue").font(.system(size: 16, weight: .semibold)).foregroundStyle(.secondary)
                .frame(maxWidth: .infinity, minHeight: 52).background(Color.primary.opacity(0.08), in: Capsule())
        }
    }
}
iOS 17 · No dependencies

Dependencies

SwiftUI
No external dependencies

Requires iOS 17