Avatar

A personโ€™s picture, or their initials when there isnโ€™t one.

PNPNPNJZJL
SK

Sam Kim

Online

PNJLSK
+5
Fig. 1 Avatars with photos, initials, and an overlapping group.

When to use it

Use Avatar wherever a person appears: comments, assignees, members. The initials fallback keeps the layout steady while images load or when thereโ€™s no photo.

Stack several with AvatarGroup, and summarize the rest with a count.

How it behaves

AvatarImage shows once the image loads; AvatarFallback shows while it loads or if it fails. Give the image alt text and keep initials short.

size is sm (24px), default (32px), or lg (40px). AvatarBadge adds a status dot; give it a name and use a status color such as bg-success.

AvatarGroup overlaps avatars with a ring in the page background; AvatarGroupCount summarizes the rest. Label the group and the count for screen readers.

Initials sit on an opaque muted fill so stacked avatars never show through each other. A faint outline appears only behind a loaded image.

Build it

Add it with the shadcn CLI:

Terminal

A complete example. Change the values to fit your product:

avatar-example.tsx

The full source is yours to edit once installed:

avatar.tsx