Skip to content
Onboarding Modal preview
Rendered from the SwiftUI source on this page.

Onboarding Modal

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

An onboarding modal with page dots.

Cards · SwiftUI · iOS 17

  • cards
  • swiftui

The actual source

OnboardingModal.swift
// Onboarding Modal · syxUI · https://syxui.dev/components/sheet-onboarding
// Free in any project. Keep this line and credit syxUI where a person can read it.

import SwiftUI

let shBlue = Color(red: 0.0, green: 0.47, blue: 1.0)

func shCard<C: View>(_ w: CGFloat, radius: CGFloat = 18, @ViewBuilder _ c: () -> C) -> some View {
    c().frame(width: w).background(Color(.systemBackground), in: RoundedRectangle(cornerRadius: radius, style: .continuous)).overlay(RoundedRectangle(cornerRadius: radius, style: .continuous).stroke(Color.primary.opacity(0.07), lineWidth: 1)).shadow(color: .black.opacity(0.05), radius: 12, y: 5)
}

// Onboarding modal
struct OnboardingModal: View {
    var body: some View {
        shCard(300, radius: 22) {
            VStack(spacing: 14) {
                Image(systemName: "sparkles").font(.system(size: 30)).foregroundStyle(.white).frame(width: 76, height: 76).background(LinearGradient(colors: [Color(red: 0.55, green: 0.40, blue: 0.90), shBlue], startPoint: .topLeading, endPoint: .bottomTrailing), in: RoundedRectangle(cornerRadius: 20, style: .continuous))
                Text("Welcome to SyxUI").font(.system(size: 19, weight: .bold))
                Text("Discover premium components and build faster than ever.").font(.system(size: 14)).foregroundStyle(.secondary).multilineTextAlignment(.center)
                HStack(spacing: 6) { ForEach(0..<3, id: \.self) { i in Capsule().fill(i == 0 ? shBlue : Color.primary.opacity(0.15)).frame(width: i == 0 ? 18 : 7, height: 7) } }
                Text("Get Started").font(.system(size: 16, weight: .semibold)).foregroundStyle(.white).frame(maxWidth: .infinity).padding(.vertical, 13).background(shBlue, in: RoundedRectangle(cornerRadius: 14, style: .continuous))
            }.padding(20)
        }
    }
}
iOS 17 · No dependencies

Dependencies

SwiftUI
No external dependencies

Requires iOS 17