
Time Slots
From syxUI — written for both platforms, not translated between them.
A booking time-slot grid.
Inputs · SwiftUI · iOS 17
- inputs
- swiftui
The actual source
PickerTimeSlots.swift
// Time Slots · syxUI · https://syxui.dev/components/picker-slots
// Free in any project. Keep this line and credit syxUI where a person can read it.
import SwiftUI
let pkBlue = Color(red: 0.0, green: 0.47, blue: 1.0)
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)
}
}
struct PickerTimeSlots: View { var body: some View { VStack(alignment: .leading, spacing: 12) { Text("Available times").font(.system(size: 15, weight: .semibold)); LazyVGrid(columns: Array(repeating: GridItem(.flexible(), spacing: 8), count: 3), spacing: 8) { ForEach(Array(["9:00", "10:30", "12:00", "1:30", "3:00", "4:30"].enumerated()), id: \.offset) { i, t in Text(t).font(.system(size: 14, weight: .medium)).foregroundStyle(i == 2 ? .white : .primary).frame(maxWidth: .infinity).padding(.vertical, 11).background(i == 2 ? pkBlue : Color.primary.opacity(0.05), in: RoundedRectangle(cornerRadius: 10)).overlay(RoundedRectangle(cornerRadius: 10).stroke(Color.primary.opacity(i == 2 ? 0 : 0.1))) } } }.formaCard().frame(width: 300) } }
iOS 17 · No dependencies
Dependencies
- SwiftUI
- No external dependencies
Requires iOS 17


