Avatar
View on shadcn/uiAn image element with a fallback for representing the user.
Installation
pnpm dlx shadcn@latest add https://dev.designsystem.wfp.org/r/avatar.jsonUsage
import { Avatar, AvatarImage, AvatarFallback } from "@/components/ui/avatar";<Avatar>
<AvatarImage src="…" alt="@johndoe" />
<AvatarFallback>JD</AvatarFallback>
</Avatar>Examples
Fallback
Use AvatarFallback to display user initials or an icon when no image is available.
Size
Use the size prop to change the size of the avatar.
Badge
Use the AvatarBadge component to add a badge indicator to the avatar. The badge is positioned at the bottom right.
Avatar Group
Use the AvatarGroup component to add a group of avatars.
Use <AvatarGroupCount> to add a count to the group.
API reference
Avatar
The Avatar component is the root component that wraps the avatar image and fallback.
| Prop | Type | Default |
|---|---|---|
size | "sm" | "default" | "lg" | "default" |
AvatarImage
The AvatarImage component displays the avatar image. It accepts all Radix UI Avatar Image props.
AvatarFallback
The AvatarFallback component displays a fallback when the image fails to load. It accepts all Radix UI Avatar Fallback props.
AvatarBadge
The AvatarBadge component displays a badge indicator on the avatar, typically positioned at the bottom right.
AvatarGroup
The AvatarGroup component displays a group of avatars with overlapping styling.
AvatarGroupCount
The AvatarGroupCount component displays a count indicator in an avatar group, typically showing the number of additional avatars.
For more information about Radix UI Avatar props, see the Radix UI Avatar documentation.
Changelog
- 21 July 2026: refined fallback styling: semibold font, auto-sized icons
- 3 March 2026: adjusted the background colour