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

Gradient Button

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

A gradient-filled call-to-action button.

Buttons · SwiftUI · iOS 17

  • buttons
  • swiftui

The actual source

GradientButtonCard.swift
// Gradient Button · syxUI · https://syxui.dev/components/btn-gradient
// Free in any project. Keep this line and credit syxUI where a person can read it.

import SwiftUI

// Gradient button
struct GradientButtonCard: View {
    var body: some View {
        Text("Upgrade to Pro").font(.system(size: 16, weight: .semibold)).foregroundStyle(.white)
            .frame(maxWidth: .infinity).padding(.vertical, 15)
            .background(LinearGradient(colors: [Color(red: 0.55, green: 0.40, blue: 0.90), Color(red: 0.36, green: 0.42, blue: 0.9)], startPoint: .leading, endPoint: .trailing), in: RoundedRectangle(cornerRadius: 14, style: .continuous)).frame(width: 300)
    }
}
iOS 17 · No dependencies

Dependencies

SwiftUI
No external dependencies

Requires iOS 17