Avatar
A personโs picture, or their initials when there isnโt one.
Sam Kim
Online
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:
1pnpm dlx shadcn@latest add https://jzbui.com/r/avatar.jsonA complete example. Change the values to fit your product:
123456import { Avatar, AvatarFallback, AvatarImage } from "@/components/ui/avatar"
<Avatar> <AvatarImage src="/avatars/priya.png" alt="Priya Nair" /> <AvatarFallback>PN</AvatarFallback></Avatar>The full source is yours to edit once installed: