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

Contact Card

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

A contact row with avatar, number and call / message actions.

Cards · SwiftUI · iOS 17

  • cards
  • swiftui

The actual source

ContactRowCard.swift
// Contact Card · syxUI · https://syxui.dev/components/card-contact
// 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)
    }
}

// Contact row card
struct ContactRowCard: View {
    let blue = Color(red: 0.0, green: 0.47, blue: 1.0)
    let green = Color(red: 0.16, green: 0.66, blue: 0.40)
    var body: some View {
        HStack(spacing: 12) {
            Image("person_2").resizable().scaledToFill().frame(width: 50, height: 50).clipShape(Circle())
            VStack(alignment: .leading, spacing: 2) {
                Text("James Wilson").font(.system(size: 16, weight: .semibold))
                Text("+1 (415) 555-0129").font(.system(size: 13)).foregroundStyle(.secondary)
            }
            Spacer()
            Image(systemName: "message.fill").font(.system(size: 15)).foregroundStyle(blue).frame(width: 34, height: 34).background(blue.opacity(0.12), in: Circle())
            Image(systemName: "phone.fill").font(.system(size: 15)).foregroundStyle(green).frame(width: 34, height: 34).background(green.opacity(0.12), in: Circle())
        }.formaCard(14).frame(width: 320)
    }
}
iOS 17 · 1 dependencies

Dependencies

SwiftUI
  • person_2 (image asset)

Requires iOS 17