Avatar
Identity in a circle — Base UI loading states, five sizes, presence badges, generative fallbacks, and groups that collapse themselves.
Installation#
pnpm dlx shadcn@latest add @davinciui/avatarUsage#
Pass a name to the fallback and it renders initials on a stable generative tint — no two teammates share a color by accident, and no image request is needed. Sizes cascade: badge, fallback type, and group count all scale with the avatar.
Avatar
├── AvatarImage
├── AvatarFallback
└── AvatarBadge
AvatarGroup
├── Avatar × n
└── AvatarGroupCount (or max={n})Composition#
Use the following composition to build a Avatar:
AvatarGroup
├── Avatar
│ ├── AvatarImage
│ ├── AvatarFallback
│ └── AvatarBadge
└── AvatarGroupCountAPI Reference#
| Prop | Type | Default |
|---|---|---|
sizeDiameter. Badge, fallback type, and count inherit it. | "xs" | "sm" | "default" | "lg" | "xl" | "default" |
nameFallback full name → initials plus stable tint. | string | — |
statusPresence tone (AvatarBadge). | "online" | "busy" | "away" | "offline" | "online" |
maxAuto-collapse group beyond N avatars into +N (AvatarGroup). | number | — |
srcImage source with Base UI loading states (AvatarImage). | string | — |
classNameAdditional classes on any part. | string | — |
Accessibility#
Base UI Avatar renders image and fallback content; pass alt on AvatarImage and name or text in AvatarFallback for a readable identity. Presence badges are unlabeled colored spans, so status is conveyed by color alone; avatars are not focusable unless wrapped in a trigger.
Motion#
Only the group overlap spacing transitions on hover, and badges do not animate. There is no prefers-reduced-motion detection, though the hover spacing change is minor and non-essential.
View source
Keep in mind
Need a custom component?
I build bespoke UI components & websites tailored to your brand.

