Skip to content
Status Dots preview
Rendered from the SwiftUI source on this page.

Status Dots

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

Avatars with online / away / busy / offline dots.

Avatars · SwiftUI · iOS 17

  • avatars
  • swiftui

The actual source

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

import SwiftUI

func av(_ name: String, _ d: CGFloat) -> some View { Image(name).resizable().scaledToFill().frame(width: d, height: d).clipShape(Circle()) }

struct AvatarStatusDots: View { private let states: [(String, Color)] = [("person_1", Color(red: 0.16, green: 0.66, blue: 0.40)), ("person_2", Color(red: 0.98, green: 0.55, blue: 0.10)), ("person_3", Color(red: 0.90, green: 0.24, blue: 0.28)), ("person_4", Color(red: 0.6, green: 0.6, blue: 0.64))]; var body: some View { HStack(spacing: 14) { ForEach(Array(states.enumerated()), id: \.offset) { _, s in av(s.0, 52).overlay(alignment: .bottomTrailing) { Circle().fill(s.1).frame(width: 15, height: 15).overlay(Circle().stroke(Color(.systemBackground), lineWidth: 2.5)) } } } } }
iOS 17 · 4 dependencies

Dependencies

SwiftUI
  • person_1 (image asset)
  • person_2 (image asset)
  • person_3 (image asset)
  • person_4 (image asset)

Requires iOS 17