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

Action Rows

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

Table rows with trailing edit and delete actions.

Cards · SwiftUI · iOS 17

  • cards
  • swiftui

The actual source

TableActions.swift
// Action Rows · syxUI · https://syxui.dev/components/table-actions
// Free in any project. Keep this line and credit syxUI where a person can read it.

import SwiftUI

let tblRed = Color(red: 0.86, green: 0.24, blue: 0.21)

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

/// Rows with trailing edit / delete actions.
struct TableActions: View {
    let rows: [String] = ["Homepage redesign", "API migration", "Onboarding flow", "Billing fixes"]
    var body: some View {
        VStack(spacing: 0) {
            ForEach(Array(rows.enumerated()), id: \.offset) { i, r in
                HStack(spacing: 14) {
                    Text(r).font(.system(size: 14, weight: .medium)).frame(maxWidth: .infinity, alignment: .leading)
                    Image(systemName: "square.and.pencil").font(.system(size: 15)).foregroundStyle(tblBlue)
                    Image(systemName: "trash").font(.system(size: 15)).foregroundStyle(tblRed)
                }
                .padding(.horizontal, 16).padding(.vertical, 13)
                if i < rows.count - 1 { Divider().padding(.leading, 16) }
            }
        }
        .tblCard(320)
    }
}
iOS 17 · No dependencies

Dependencies

SwiftUI
No external dependencies

Requires iOS 17