Skip to content
Pricing Card preview
Rendered from the SwiftUI source on this page.

Pricing Card

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

A subscription tier with price, a feature checklist and a CTA.

Cards · SwiftUI · iOS 17

  • cards
  • swiftui

The actual source

PricingCard.swift
// Pricing Card · syxUI · https://syxui.dev/components/card-pricing
// Free in any project. Keep this line and credit syxUI where a person can read it.

import SwiftUI

extension View {
    func formaCard(_ pad: CGFloat = 18) -> some View {
        self.padding(pad)
            .background(Color(.systemBackground), in: RoundedRectangle(cornerRadius: 20, style: .continuous))
            .overlay(RoundedRectangle(cornerRadius: 20, style: .continuous).stroke(Color.primary.opacity(0.06), lineWidth: 1))
            .shadow(color: .black.opacity(0.05), radius: 14, x: 0, y: 6)
    }
}

// Pricing card
struct PricingCard: View {
    let blue = Color(red: 0.0, green: 0.47, blue: 1.0)
    var body: some View {
        VStack(alignment: .leading, spacing: 14) {
            VStack(alignment: .leading, spacing: 4) {
                Text("Pro").font(.system(size: 15, weight: .semibold)).foregroundStyle(blue)
                HStack(alignment: .firstTextBaseline, spacing: 2) {
                    Text("$12").font(.system(size: 34, weight: .bold))
                    Text("/mo").font(.system(size: 15)).foregroundStyle(.secondary)
                }
            }
            VStack(alignment: .leading, spacing: 9) {
                ForEach(["Unlimited projects", "Priority support", "Advanced analytics"], id: \.self) { f in
                    HStack(spacing: 9) {
                        Image(systemName: "checkmark.circle.fill").font(.system(size: 15)).foregroundStyle(blue)
                        Text(f).font(.system(size: 14))
                    }
                }
            }
            Text("Choose plan").font(.system(size: 15, weight: .semibold)).foregroundStyle(.white)
                .frame(maxWidth: .infinity).padding(.vertical, 11).background(blue, in: RoundedRectangle(cornerRadius: 12, style: .continuous))
        }.formaCard().frame(width: 250)
    }
}
iOS 17 · No dependencies

Dependencies

SwiftUI
No external dependencies

Requires iOS 17