Skip to content
Event Calendar preview
Rendered from the SwiftUI source on this page.

Event Calendar

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

A calendar with event dots.

Inputs · SwiftUI · iOS 17

  • inputs
  • swiftui

The actual source

PickerCalendarEvents.swift
// Event Calendar · syxUI · https://syxui.dev/components/picker-events
// 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)
    }
}

func weekdays() -> some View { HStack(spacing: 0) { ForEach(Array(["S", "M", "T", "W", "T", "F", "S"].enumerated()), id: \.offset) { _, d in Text(d).font(.system(size: 11, weight: .medium)).foregroundStyle(.secondary).frame(maxWidth: .infinity) } } }

struct PickerCalendarEvents: View { var body: some View { VStack(spacing: 12) { HStack { Text("July 2026").font(.system(size: 16, weight: .semibold)); Spacer() }; weekdays(); LazyVGrid(columns: Array(repeating: GridItem(.flexible()), count: 7), spacing: 6) { ForEach(Array(0..<3), id: \.self) { _ in Color.clear.frame(height: 34) }; ForEach(1...31, id: \.self) { d in VStack(spacing: 2) { Text("\(d)").font(.system(size: 13, weight: d == 12 ? .bold : .regular)).foregroundStyle(d == 12 ? .white : .primary).frame(width: 28, height: 28).background { if d == 12 { Circle().fill(pkBlue) } }; if [8, 12, 20, 25].contains(d) { Circle().fill(d == 12 ? Color.clear : pkBlue).frame(width: 4, height: 4) } else { Color.clear.frame(height: 4) } } } } }.formaCard().frame(width: 320) } }
iOS 17 · No dependencies

Dependencies

SwiftUI
No external dependencies

Requires iOS 17