
Stat Rows
From syxUI — written for both platforms, not translated between them.
Rows with a label, value and trend chip.
Cards · SwiftUI · iOS 17
- cards
- swiftui
The actual source
StatRow.swift
// Stat Rows · syxUI · https://syxui.dev/components/list-stat
// Free in any project. Keep this line and credit syxUI where a person can read it.
import SwiftUI
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)
}
}
// Stat row
struct StatRow: View {
let rows: [(String, String, String, Color)] = [("Revenue", "$48,290", "+12%", Color(red: 0.16, green: 0.66, blue: 0.40)), ("Expenses", "$21,140", "-4%", Color(red: 0.90, green: 0.24, blue: 0.28))]
var body: some View {
VStack(spacing: 0) {
ForEach(Array(rows.enumerated()), id: \.offset) { i, r in
HStack { Text(r.0).font(.system(size: 15)); Spacer(); Text(r.1).font(.system(size: 15, weight: .semibold)); Text(r.2).font(.system(size: 12, weight: .semibold)).foregroundStyle(r.3).padding(.leading, 4) }.padding(.vertical, 11)
if i < rows.count - 1 { Divider() }
}
}.formaCard(14).frame(width: 320)
}
}
iOS 17 · No dependencies
Dependencies
- SwiftUI
- No external dependencies
Requires iOS 17


