Autumn Sale50% offCOMPOT

SwiftUI Buttons

Prominent CTA buttons, spring-animated controls, increment steppers, bordered buttons, and Apple Sign-in. (34 components available in Compot).

1 of 34Free ComponentiOS 16.0+

Primary Button Basic

High-emphasis prominent action button with standard SwiftUI prominence styling and haptic feedback.

View Component & Details
PrimaryButtonBasic.swift
import SwiftUI

struct PrimaryButtonBasic: View {
    var body: some View {
        Button("Primary Action") {
            // Action for the button
            print("Button tapped")
        }
        .buttonStyle(.borderedProminent)
        .help("Accessibility hint")
    }
}

#Preview {
    PrimaryButtonBasic()
}
2 of 34Free ComponentiOS 16.0+

CTA Button Large Basic

Full-width, high-impact call-to-action button designed for onboarding screens, welcome flows, and paywalls.

View Component & Details
CTAButtonLargeBasic.swift
import SwiftUI

struct CTAButtonLargeBasic: View {
    var body: some View {
        Button {
            // Action for the button
            print("Button tapped")
        } label: {
            HStack(spacing: 8) {
                Text("Get Started")
                Image(systemName: "arrow.right")
            }
            .padding()
            .font(.headline)
            .foregroundStyle(.white)
            .frame(alignment: .center)
        }
        .frame(maxWidth: 450)
        .padding(.horizontal, 32)
        .background(Color.accentColor)
        .clipShape(Capsule())
        .padding()
        .help("Accessibility hint")
    }
}

#Preview {
    CTAButtonLargeBasic()
}
3 of 34Free ComponentiOS 16.0+

Secondary Button Basic

Medium-emphasis secondary action button styled for alternative user workflows and dismissal actions.

View Component & Details
SecondaryButtonBasic.swift
import SwiftUI

struct SecondaryButtonBasic: View {
    var body: some View {
        Button {
            // Action for the button
            print("Button tapped")
        } label: {
            Text("Secondary Action")
        }
        .font(.headline)
        .padding(.vertical, 10)
        .padding(.horizontal, 15)
        .overlay(
            RoundedRectangle(cornerRadius: 12)
            .stroke(lineWidth: 1)
        )
        .foregroundStyle(Color.accentColor)
    }
}

#Preview {
    SecondaryButtonBasic()
}
4 of 34Free ComponentiOS 16.0+

Tertiary Button Basic

Low-emphasis borderless button for subtle inline actions, footnotes, and modal dismissal.

View Component & Details
TertiaryButtonBasic.swift
import SwiftUI

struct TertiaryButtonBasic: View {
    var body: some View {
        Button("Tap Me") {
            // Action for the button
            print("Button tapped")
        }
        .buttonStyle(.bordered)
        .help("Accessibility hint")
    }
}

#Preview {
    TertiaryButtonBasic()
}
5 of 34Free ComponentiOS 16.0+

Icon Button Tertiary Basic

Compact circular tertiary icon button for header navigation bars and utility menus.

View Component & Details
IconButtonTertiaryBasic.swift
import SwiftUI

struct IconButtonTertiaryBasic: View {
    var body: some View {
        Button {
            // Action
        } label: {
            Image(systemName: "plus")
            .font(.title3)
            .padding(16)
            .background(.thinMaterial)
            .clipShape(Circle())
        }
        .foregroundStyle(Color.accentColor)
        .shadow(color: .gray.opacity(0.3), radius: 2)
        .padding()
        .help("Accessibility hint")
    }
}

#Preview {
    IconButtonTertiaryBasic()
}
6 of 34Pro ComponentiOS 16.0+

Bouncy Button Icon

Interactive button featuring fluid spring animations and smooth scale feedback upon tap.

View Component & Details
BouncyButtonIcon.swift
Unlock in App
import SwiftUI

struct BouncyButtonIcon: View {
    @State private var bounceButton = false

    var body: some View {
        Button(
            "Bouncy Button",

        // ...
        // Complete source code available in Compot Pro on the App Store.
Compot Pro Component

Unlock full code & interactive preview

Interactive live preview and complete SwiftUI code available in the Compot App.

Available for macOS & iOS • 85+ free components included

More SwiftUI Buttons Components (28)

Browse additional buttons components from our library. Click through to view standalone source code and usage examples.

ButtonsiOS 16.0+

Button with Repeat Behavior

Stepper-like button with continuous press-and-hold repeating action for counters and volume adjustment.

View Component & Code
ButtonsiOS 16.0+

Button for Copying

Smart copy button that temporarily switches icon and text to "Copied!" with tactile haptic feedback.

View Component & Code
ButtonsiOS 16.0+

Bordered Green Rounded Button (Regular)

Standard-sized bordered button with custom green tint and continuous rounded corners.

View Component & Code
ButtonsiOS 16.0+

Bordered Green Rounded Button (Mini)

Compact mini bordered button for tight layouts, list items, and secondary badges.

View Component & Code
ButtonsiOS 16.0+

Bordered Green Rounded Button (Small)

Small bordered action button with green rounded rectangle styling.

View Component & Code
ButtonsiOS 16.0+

Bordered Green Rounded Button (Large)

Large prominent bordered button with custom green styling.

View Component & Code
ButtonsiOS 16.0+

Bordered Green Rounded Button (Extra Large)

Extra-large full-width bordered action button with rounded rectangle styling.

View Component & Code
ButtonsiOS 16.0+

Icon Button (Small)

Small circular icon-only button for compact toolbars and cards.

View Component & Code
ButtonsiOS 16.0+

Icon Button (Regular)

Standard-sized icon-only button with circular background padding.

View Component & Code
ButtonsiOS 16.0+

Icon Button (Large)

Large circular icon button for floating actions and primary media controls.

View Component & Code
ButtonsiOS 16.0+

Icon Button (Extra Large)

Extra-large hero icon button for prominent media playback or recording.

View Component & Code
ButtonsiOS 16.0+

Prominent Button (Small)

Small filled capsule button for quick inline actions.

View Component & Code
ButtonsiOS 16.0+

Prominent Button (Regular)

Standard-sized filled prominent button with smooth corner radius.

View Component & Code
ButtonsiOS 16.0+

Prominent Button (Large)

Large filled prominent button for main user interactions.

View Component & Code
ButtonsiOS 16.0+

Prominent Button (Extra Large)

Extra-large filled prominent button for hero headers.

View Component & Code
ButtonsiOS 16.0+

Prominent Destructive Button (Large)

Prominent destructive action button in system red for critical deletion confirmations.

View Component & Code
ButtonsiOS 16.0+

Prominent Destructive Icon Button (Large)

Large icon-only destructive button for deletion triggers in toolbars.

View Component & Code
ButtonsiOS 16.0+

Stat Tile Button with Inflection

Dashboard metric card button featuring dynamic English pluralization and inflection rules.

View Component & Code
ButtonsiOS 16.0+

Secondary Button Large (Custom Style)

Large customized secondary button with custom padding and background fill.

View Component & Code
ButtonsiOS 16.0+

Secondary Button Medium (Custom Style)

Medium customized secondary button with modern rounded styling.

View Component & Code
ButtonsiOS 16.0+

Subscription Button Simple

Dedicated recurring billing / subscription purchase button with StoreKit pricing labels.

View Component & Code
ButtonsiOS 16.0+

Update Button

App update trigger button with version badge and leading icon.

View Component & Code
ButtonsiOS 16.0+

Record Button with State

Audio/video recording toggle button with morphing record/stop states and pulse animation.

View Component & Code
ButtonsiOS 16.0+

Tertiary Icon Button Large

Large borderless icon button for minimalist toolbars and bottom sheets.

View Component & Code
ButtonsiOS 16.0+

Done Button

Toggleable completion button with smooth checkmark state transition.

View Component & Code
ButtonsiOS 16.0+

Favorite Button

Heart toggle button with spring animation and fill transition for bookmarking.

View Component & Code
ButtonsiOS 16.0+

Open Settings Button

One-tap navigation trigger that opens the app’s system settings directly in iOS Settings.

View Component & Code
ButtonsiOS 16.0+

Sign in with Apple Button

Native Apple Authentication button following Apple Human Interface Guidelines.

View Component & Code