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

Spec Sheet

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

A key/value spec sheet with hairline dividers.

Cards · SwiftUI · iOS 17

  • cards
  • swiftui

The actual source

TableSpec.swift
// Spec Sheet · syxUI · https://syxui.dev/components/table-spec
// Free in any project. Keep this line and credit syxUI where a person can read it.

import SwiftUI

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)
    }
}

/// Spec sheet - key on the left, bold value on the right, hairline between rows.
struct TableSpec: View {
    let rows: [(String, String)] = [
        ("Display", "6.7″ OLED"), ("Chip", "A18 Pro"), ("Storage", "256 GB"),
        ("Camera", "48 MP"), ("Battery", "4,685 mAh"), ("Weight", "199 g"),
    ]
    var body: some View {
        VStack(spacing: 0) {
            ForEach(Array(rows.enumerated()), id: \.offset) { i, r in
                HStack {
                    Text(r.0).font(.system(size: 14)).foregroundStyle(.secondary)
                    Spacer()
                    Text(r.1).font(.system(size: 14, weight: .semibold))
                }
                .padding(.horizontal, 16).padding(.vertical, 12)
                if i < rows.count - 1 { Divider().padding(.leading, 16) }
            }
        }
        .tblCard(300)
    }
}
iOS 17 · No dependencies

Dependencies

SwiftUI
No external dependencies

Requires iOS 17