data-display/DSAvatar

DSAvatar

data-display
since v1.0

Represents a user with initials or an image. Supports 5 sizes and an online/offline/busy/away status indicator.

iOS 17+macOS 14+

Purpose

Visual identification of users in lists, profiles, comments, and navigation bars.

Interactive Reference

Live showroom

Need the full visual surface?

Screenshots do not scale well across every component, state, and variant. For the real interactive reference, import the package and launch DSShowcaseRoot().

Best for exploring:

variants, states, categories, and real app examples in one place.

Props

PropTypeDefaultDescription
initialsString?nilUp to 2 characters as a fallback.
imageURLURL?nilUser image URL.
sizeDSAvatarSize.md.xs / .sm / .md / .lg / .xl
statusDSAvatarStatus?nilPresence indicator (.online, .offline, .busy, .away).
tintColorDSColor.primaryBackground and initials text colour.

Examples

Avatar with status

Online user in a sidebar.

swift
DSAvatar(
    initials: "JD",
    size: .lg,
    status: .online,
    tint: DSColor.primary
)

Avatar group

Project collaborators.

swift
DSAvatarGroup(
    items: [
        ("AB", DSColor.primary),
        ("CD", DSColor.accent),
        ("EF", DSColor.success),
    ],
    size: .sm,
    max: 3
)

Usage Guidelines

  • Always provide initials as a fallback when imageURL is nil.
  • .busy means do-not-disturb, not an error.

Related Components