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 shared-contact message with avatar and Message / Call actions.

Chat · SwiftUI · iOS 17

  • chat
  • swiftui

The actual source

ChatContactCard.swift
// Contact Card · syxUI · https://syxui.dev/components/chat-contact
// Free in any project. Keep this line and credit syxUI where a person can read it.

import SwiftUI

// Shared contact card
struct ChatContactCard: View {
    let blue = Color(red: 0.0, green: 0.47, blue: 1.0)
    var body: some View {
        HStack {
            VStack(spacing: 10) {
                HStack(spacing: 10) {
                    Image("person_4").resizable().scaledToFill().frame(width: 44, height: 44).clipShape(Circle())
                    VStack(alignment: .leading, spacing: 2) {
                        Text("Arjun Patel").font(.system(size: 15, weight: .semibold))
                        Text("Contact").font(.system(size: 12)).foregroundStyle(.secondary)
                    }
                    Spacer()
                }
                HStack(spacing: 8) {
                    Label("Message", systemImage: "message.fill").font(.system(size: 13, weight: .medium)).foregroundStyle(blue)
                        .frame(maxWidth: .infinity).padding(.vertical, 8).background(blue.opacity(0.12), in: Capsule())
                    Label("Call", systemImage: "phone.fill").font(.system(size: 13, weight: .medium)).foregroundStyle(blue)
                        .frame(maxWidth: .infinity).padding(.vertical, 8).background(blue.opacity(0.12), in: Capsule())
                }
            }
            .padding(14).frame(width: 260)
            .background(Color(.systemGray6), in: RoundedRectangle(cornerRadius: 18, style: .continuous))
            Spacer(minLength: 20)
        }
    }
}
iOS 17 · 1 dependencies

Dependencies

SwiftUI
  • person_4 (image asset)

Requires iOS 17