Skip to content
Checklist Group preview
Rendered from the SwiftUI source on this page.

Checklist Group

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

An expandable onboarding checklist with progress.

Accordions · SwiftUI · iOS 17

  • accordion
  • swiftui

The actual source

AccChecklist.swift
// Checklist Group · syxUI · https://syxui.dev/components/acc-checklist
// 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)
    }
}

// Expandable checklist with progress
struct AccChecklist: View {
    @State private var open = true
    let items = [("Verify your email", true), ("Add a profile photo", true), ("Connect a bank account", false)]
    let green = Color(red: 0.16, green: 0.66, blue: 0.40)
    var body: some View {
        VStack(spacing: 0) {
            HStack {
                Text("Setup").font(.system(size: 15, weight: .semibold))
                Text("2 of 3").font(.system(size: 12, weight: .medium)).foregroundStyle(green).padding(.horizontal, 8).padding(.vertical, 3).background(green.opacity(0.14), in: Capsule())
                Spacer()
                Image(systemName: "chevron.down").font(.system(size: 12, weight: .semibold)).foregroundStyle(.secondary).rotationEffect(.degrees(open ? 180 : 0))
            }.padding(.vertical, 13)
            if open {
                Divider().padding(.bottom, 4)
                ForEach(Array(items.enumerated()), id: \.offset) { _, it in
                    HStack(spacing: 10) {
                        Image(systemName: it.1 ? "checkmark.circle.fill" : "circle").font(.system(size: 18)).foregroundStyle(it.1 ? green : .secondary.opacity(0.5))
                        Text(it.0).font(.system(size: 14)).strikethrough(it.1).foregroundStyle(it.1 ? .secondary : .primary)
                        Spacer()
                    }.padding(.vertical, 7)
                }
            }
        }.formaCard(16).frame(width: 320)
    }
}
iOS 17 · No dependencies

Dependencies

SwiftUI
No external dependencies

Requires iOS 17