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

Booking Card

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

An appointment card with provider, date / time and a status badge.

Cards · SwiftUI · iOS 17

  • cards
  • swiftui

The actual source

BookingCard.swift
// Booking Card · syxUI · https://syxui.dev/components/card-booking
// 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)
    }
}

// Booking card
struct BookingCard: View {
    let green = Color(red: 0.16, green: 0.66, blue: 0.40)
    var body: some View {
        VStack(alignment: .leading, spacing: 12) {
            HStack {
                Text("Haircut & Style").font(.system(size: 16, weight: .semibold))
                Spacer()
                Text("Confirmed").font(.system(size: 11, weight: .semibold)).foregroundStyle(green).padding(.horizontal, 8).padding(.vertical, 3).background(green.opacity(0.14), in: Capsule())
            }
            HStack(spacing: 10) {
                Image("person_2").resizable().scaledToFill().frame(width: 36, height: 36).clipShape(Circle())
                VStack(alignment: .leading, spacing: 1) {
                    Text("with James Wilson").font(.system(size: 13, weight: .medium))
                    Text("Senior Stylist").font(.system(size: 12)).foregroundStyle(.secondary)
                }
                Spacer()
            }
            Divider()
            HStack(spacing: 16) {
                Label("Jul 24", systemImage: "calendar").font(.system(size: 13, weight: .medium))
                Label("2:30 PM", systemImage: "clock").font(.system(size: 13, weight: .medium))
            }
        }.formaCard(14).frame(width: 300)
    }
}
iOS 17 · 1 dependencies

Dependencies

SwiftUI
  • person_2 (image asset)

Requires iOS 17