Skip to content
Page Dots preview
Rendered from the SwiftUI source on this page.

Page Dots

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

A carousel page indicator with chevrons.

Navigation · SwiftUI · iOS 17

  • navigation
  • swiftui

The actual source

PageDotsNav.swift
// Page Dots · syxUI · https://syxui.dev/components/nav2-page-dots
// Free in any project. Keep this line and credit syxUI where a person can read it.

import SwiftUI

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

// Carousel page dots
struct PageDotsNav: View {
    let current = 1
    var body: some View {
        HStack(spacing: 16) {
            Image(systemName: "chevron.left").font(.system(size: 14, weight: .semibold)).foregroundStyle(.secondary)
            HStack(spacing: 7) {
                ForEach(0..<5, id: \.self) { i in Capsule().fill(i == current ? navBlue : Color.primary.opacity(0.2)).frame(width: i == current ? 22 : 7, height: 7) }
            }
            Image(systemName: "chevron.right").font(.system(size: 14, weight: .semibold)).foregroundStyle(.primary)
        }
    }
}
iOS 17 · No dependencies

Dependencies

SwiftUI
No external dependencies

Requires iOS 17