
Step Accordion
From syxUI — written for both platforms, not translated between them.
A self-contained step accordion — SwiftUI, styled from system tokens.
Accordions · SwiftUI · iOS 17
- accordion
- swiftui
The actual source
StepAccordion.swift
// Step Accordion · syxUI · https://syxui.dev/components/accordion-steps
// 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)
}
}
// Accordion - numbered steps
struct StepAccordion: View {
@State private var open = 1
let steps = [("Create your account", "Sign up with email or Apple in seconds."),
("Add your first tool", "Fill in the details - we auto-format everything."),
("Launch to the community", "Go live and start collecting reviews.")]
var body: some View {
VStack(spacing: 0) {
ForEach(steps.indices, id: \.self) { i in
Button { withAnimation(.snappy(duration: 0.25)) { open = i } } label: {
HStack(alignment: .top, spacing: 12) {
ZStack {
Circle().fill(open == i ? Color.primary : Color.primary.opacity(0.08)).frame(width: 26, height: 26)
Text("\(i + 1)").font(.system(size: 13, weight: .bold)).foregroundStyle(open == i ? Color(.systemBackground) : .secondary)
}
VStack(alignment: .leading, spacing: 4) {
Text(steps[i].0).font(.system(size: 15, weight: .semibold)).foregroundStyle(.primary)
if open == i { Text(steps[i].1).font(.system(size: 13)).foregroundStyle(.secondary).fixedSize(horizontal: false, vertical: true) }
}
Spacer()
}.padding(.vertical, 12)
}.buttonStyle(.plain)
}
}.formaCard()
}
}
iOS 17 · 1 dependencies
Dependencies
- SwiftUI
- formaCard
Requires iOS 17

