Skip to content
Avatar Row preview
Rendered from the SwiftUI source on this page.

Avatar Row

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

An avatar row with an online status dot.

Cards · SwiftUI · iOS 17

  • cards
  • swiftui

The actual source

AvatarStatusRow.swift
// Avatar Row · syxUI · https://syxui.dev/components/list-avatar-status
// Free in any project. Keep this line and credit syxUI where a person can read it.

import SwiftUI

let listGreen = Color(red: 0.20, green: 0.78, blue: 0.35)

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

// Avatar row with status
struct AvatarStatusRow: View {
    var body: some View {
        HStack(spacing: 12) {
            Image("person_3").resizable().scaledToFill().frame(width: 46, height: 46).clipShape(Circle()).overlay(alignment: .bottomTrailing) { Circle().fill(listGreen).frame(width: 13, height: 13).overlay(Circle().stroke(Color(.systemBackground), lineWidth: 2)) }
            VStack(alignment: .leading, spacing: 2) { Text("Mia Chen").font(.system(size: 16, weight: .medium)); Text("Active now").font(.system(size: 13)).foregroundStyle(listGreen) }
            Spacer()
            Image(systemName: "ellipsis").foregroundStyle(.secondary)
        }.formaCard(14).frame(width: 320)
    }
}
iOS 17 · 1 dependencies

Dependencies

SwiftUI
  • person_3 (image asset)

Requires iOS 17