
Paginated Table
From syxUI — written for both platforms, not translated between them.
A table with a pagination footer and page pills.
Cards · SwiftUI · iOS 17
- cards
- swiftui
The actual source
TablePagination.swift
// Paginated Table · syxUI · https://syxui.dev/components/table-pagination
// Free in any project. Keep this line and credit syxUI where a person can read it.
import SwiftUI
let tblBlue = Color(red: 0.0, green: 0.47, blue: 1.0)
extension View {
func tblCard(_ w: CGFloat) -> some View {
self.frame(width: w)
.background(Color(.systemBackground), in: RoundedRectangle(cornerRadius: 18, style: .continuous))
.clipShape(RoundedRectangle(cornerRadius: 18, style: .continuous))
.overlay(RoundedRectangle(cornerRadius: 18, style: .continuous).stroke(Color.primary.opacity(0.08), lineWidth: 1))
.shadow(color: .black.opacity(0.04), radius: 10, x: 0, y: 4)
}
}
/// Table with a pagination footer (range label + page pills).
struct TablePagination: View {
let rows: [(String, String)] = [
("Olivia Brooks", "olivia@acme.co"), ("Ethan Ward", "ethan@acme.co"), ("Sophia Lin", "sophia@acme.co"),
]
var body: some View {
VStack(spacing: 0) {
ForEach(Array(rows.enumerated()), id: \.offset) { i, r in
HStack {
VStack(alignment: .leading, spacing: 2) {
Text(r.0).font(.system(size: 14, weight: .medium))
Text(r.1).font(.system(size: 12)).foregroundStyle(.secondary)
}
Spacer()
}.padding(.horizontal, 16).padding(.vertical, 11)
if i < rows.count - 1 { Divider().padding(.leading, 16) }
}
Divider()
HStack(spacing: 6) {
Text("1–3 of 24").font(.system(size: 12)).foregroundStyle(.secondary)
Spacer()
Image(systemName: "chevron.left").font(.system(size: 12, weight: .semibold)).foregroundStyle(.secondary)
ForEach([1, 2, 3], id: \.self) { p in
Text("\(p)").font(.system(size: 13, weight: .semibold))
.foregroundStyle(p == 1 ? Color.white : Color.primary)
.frame(width: 26, height: 26)
.background { if p == 1 { RoundedRectangle(cornerRadius: 7).fill(tblBlue) } }
}
Image(systemName: "chevron.right").font(.system(size: 12, weight: .semibold)).foregroundStyle(tblBlue)
}.padding(.horizontal, 14).padding(.vertical, 10)
}
.tblCard(330)
}
}
iOS 17 · No dependencies
Dependencies
- SwiftUI
- No external dependencies
Requires iOS 17


