
Plan Selector
From syxUI — written for both platforms, not translated between them.
A subscription plan picker - the chosen plan gets an accent ring, a checkmark and a savings badge.
Inputs · SwiftUI · iOS 17
- inputs
- swiftui
The actual source
PlanSelectorCard.swift
// Plan Selector · syxUI · https://syxui.dev/components/sel-plan
// 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)
}
}
// Subscription plan selector - accent ring + check on the picked plan (Acorns/Liven)
struct PlanSelectorCard: View {
@State private var selected = 1
let accent = Color(red: 0.16, green: 0.66, blue: 0.40)
let plans = [("Monthly", "$9.99", "billed monthly", ""),
("Annual", "$59.99", "billed yearly", "Save 50%")]
var body: some View {
VStack(spacing: 10) {
ForEach(Array(plans.enumerated()), id: \.offset) { i, p in
let on = selected == i
HStack(spacing: 12) {
ZStack {
Circle().fill(on ? accent : Color.clear).frame(width: 22, height: 22)
Circle().stroke(on ? Color.clear : Color.primary.opacity(0.28), lineWidth: 1.5).frame(width: 22, height: 22)
if on {
Image(systemName: "checkmark").font(.system(size: 11, weight: .bold)).foregroundStyle(.white)
}
}
VStack(alignment: .leading, spacing: 2) {
Text(p.0).font(.system(size: 15, weight: .semibold))
Text(p.2).font(.system(size: 12)).foregroundStyle(.secondary)
}
Spacer()
if !p.3.isEmpty {
Text(p.3).font(.system(size: 11, weight: .bold)).foregroundStyle(accent)
.padding(.horizontal, 8).padding(.vertical, 4)
.background(accent.opacity(0.14), in: Capsule())
}
Text(p.1).font(.system(size: 15, weight: .bold))
}
.padding(14)
.background(on ? accent.opacity(0.07) : Color.clear, in: RoundedRectangle(cornerRadius: 14, style: .continuous))
.overlay(RoundedRectangle(cornerRadius: 14, style: .continuous).stroke(on ? accent : Color.primary.opacity(0.12), lineWidth: on ? 2 : 1))
.contentShape(Rectangle())
.onTapGesture { withAnimation(.snappy) { selected = i } }
}
}.formaCard(14)
}
}
iOS 17 · 1 dependencies
Dependencies
- SwiftUI
- formaCard
Requires iOS 17


