Installation
Theme
Mode

Data display

Avatar

Who’s who across the product — assignees, members, commenters. Falls back gracefully from photo to colored initials to a generic icon, and stacks into groups when space is tight.

$npx shadcn@latest add @orbit/avatar

Overview

Photo, initials, presence, count badges, and stacks.

Sam ChenPNMS3
ARSam ChenJLPN+2

Fallbacks

A photo when there is one; otherwise initials on a color derived from the name — stable per person — and a neutral icon when there’s no identity at all.

Photo — uses the image, cover-fit and clipped to the shape. Falls back to initials on load error.
Sam Chen
Initials — one or two letters on a deterministic color from the name.
PN
Icon — generic glyph for unassigned or unknown people.

Sizes

xs 20 · sm 26 · md 32 (default) · lg 40 · xl 56 · 2xl 80px. Initials, presence dots, and badges scale with the avatar.

JL
xs
20px
JL
sm
26px
JL
md
32px
JL
lg
40px
JL
xl
56px
JL
2xl
80px

Shape, presence & badge

Circle by default, square for entities like teams or bots. A presence dot or a count badge sits on the ring.

Presence
ARonline
PNaway
JLbusy
DPoffline
Square & badge
OTsquare
Sam Chenphoto
AR5badge
MS99+99+

Deterministic colors

Each name hashes to a fixed slot in the palette (12 solid · 8 soft), so a person keeps the same color everywhere. Solid by default; a soft tint is available for light surfaces.

Solid
ARSCJLPNMSDPRFNATPWZ
Soft
ARSCJLPNMSDPRFNATPWZ

Group stacks

Pass people or names to overlap avatars into a stack (34% of the diameter); max caps the count and rolls the rest into a +N chip.

max 3
ARSam ChenJL+3
max 5
ARSam ChenJLPNMS+1
large
ARSam ChenJLPN+2
In context — match ringColor to the surface behind the stack
ARSam ChenJLPN+2
6 collaborators

Props

PropTypeDefaultDescription
namestringPerson's name — initials, deterministic color, alt text, and title all derive from it.
imagestringPhoto URL, cover-fit. Falls back to initials if it fails to load.
size"xs" | "sm" | "md" | "lg" | "xl" | "2xl""md"Diameter: 20 / 26 / 32 / 40 / 56 / 80px.
shape"circle" | "square""circle"Square suits entities like teams or bots.
softbooleanfalseSoft tint instead of a solid fill for initials.
iconbooleanfalseGeneric person glyph — automatic when there’s no name or image.
presence"none" | "online" | "away" | "busy" | "offline""none"Presence dot on the bottom-right rim, ringed with ringColor.
badgenumber | stringCount badge on the top-right rim; values over 99 clamp to 99+.
ringColorstringvar(--surface)Ring behind the presence dot / badge and between stacked avatars.
people / names / maxAvatarPerson[] / string / numberGroup mode — delegates to AvatarGroup (spec parity).
…restHTMLAttributes<HTMLSpanElement>Everything else is forwarded to the root, including ref.

AvatarGroup props

PropTypeDefaultDescription
people{ name: string; image?: string }[]Members, in display order.
namesstringComma-separated names shorthand for people.
maxnumber4Max visible avatars before the rest roll into a +N chip.
size / shape / softAvatarSize / AvatarShape / boolean"md" / "circle" / falseForwarded to each member avatar.
ringColorstringvar(--surface)Ring separating overlapped avatars — match the surface behind the stack.
…restHTMLAttributes<HTMLDivElement>Forwarded to the role=“group” root, including ref.

Usage

Identity should always be legible.

Do

Always provide a name

Initials and color come from it — and it’s the alt text and tooltip for the photo.

Don’t

Put many big avatars in a row

Beyond a few, switch to a stack with +N so the layout stays calm.

Do

Keep one color per person

The deterministic hash does this for free — don’t override it per screen.

Don’t

Use presence as the only signal

Pair the dot with text where the state actually matters; color alone isn’t enough.

Keyboard & accessibility

The single avatar renders role=img with aria-label and title set to the name (alt on photos); stacks render role=group with a member count. White text meets AA on every palette fill, and presence dots are aria-hidden — pair them with text where the state matters.

Pair presence with text where the state matters
SC
Sam Chen
Online