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

Pagination

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

Numbered pagination controls with chevrons.

Buttons · SwiftUI · iOS 17

  • buttons
  • swiftui

The actual source

PaginationButtonCard.swift
// Pagination · syxUI · https://syxui.dev/components/btn-pagination
// Free in any project. Keep this line and credit syxUI where a person can read it.

import SwiftUI

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

// Pagination controls
struct PaginationButtonCard: View {
    var body: some View {
        HStack(spacing: 8) {
            Image(systemName: "chevron.left").font(.system(size: 13, weight: .semibold)).foregroundStyle(.secondary).frame(width: 36, height: 36).overlay(Circle().stroke(Color.primary.opacity(0.12)))
            ForEach(Array([1, 2, 3].enumerated()), id: \.offset) { _, n in
                Text("\(n)").font(.system(size: 14, weight: .medium)).foregroundStyle(n == 1 ? .white : .primary).frame(width: 36, height: 36).background(n == 1 ? btnBlue : .clear, in: Circle()).overlay(Circle().stroke(n == 1 ? .clear : Color.primary.opacity(0.12)))
            }
            Image(systemName: "chevron.right").font(.system(size: 13, weight: .semibold)).foregroundStyle(.primary).frame(width: 36, height: 36).overlay(Circle().stroke(Color.primary.opacity(0.12)))
        }
    }
}
iOS 17 · No dependencies

Dependencies

SwiftUI
No external dependencies

Requires iOS 17