Avatar
A Tailwind CSS avatar component for displaying user profile images.

<img
class="avatar"
src="https://cdn.gufo.dev/stockphotos/1c7a7245.webp"
alt="Sarah Johnson"
/>Avatars work well with labels for user identification.
Sarah Johnson
Product Designer
<div class="flex items-center gap-3">
<img
class="avatar"
src="https://cdn.gufo.dev/stockphotos/1c7a7245.webp"
alt="Sarah Johnson"
/>
<div class="text-sm">
<p class="font-semibold text-foreground">Sarah Johnson</p>
<p class="text-muted-foreground">Product Designer</p>
</div>
</div>With fallback
When no image is available, display initials or an icon as a fallback.
<span class="avatar-fallback">JD</span>
<span class="avatar-fallback"><svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="M19 21v-2a4 4 0 0 0-4-4H9a4 4 0 0 0-4 4v2"/><circle cx="12" cy="7" r="4"/></svg></span>Sizes
Avatars come in multiple sizes.

<img
class="avatar avatar-sm"
src="https://cdn.gufo.dev/stockphotos/1c7a7245.webp"
alt="Sarah Johnson"
/>
<img
class="avatar"
src="https://cdn.gufo.dev/stockphotos/1c7a7245.webp"
alt="Sarah Johnson"
/>
<img
class="avatar avatar-lg"
src="https://cdn.gufo.dev/stockphotos/1c7a7245.webp"
alt="Sarah Johnson"
/>Fallbacks also scale with the size.
<span class="avatar-fallback avatar-sm">JD</span>
<span class="avatar-fallback">JD</span>
<span class="avatar-fallback avatar-lg">JD</span>Avatar group
Display multiple avatars in a stacked group.
<div class="avatar-group">
<img
class="avatar"
src="https://cdn.gufo.dev/stockphotos/1c7a7245.webp"
alt="Sarah Johnson"
/>
<img
class="avatar"
src="https://cdn.gufo.dev/stockphotos/7bd8889a.webp"
alt="Michael Chen"
/>
<img
class="avatar"
src="https://cdn.gufo.dev/stockphotos/a8a338c1.webp"
alt="Emma Wilson"
/>
<img
class="avatar"
src="https://cdn.gufo.dev/stockphotos/1c7a7245.webp"
alt="David Park"
/>
</div>Avatar groups work with different sizes.
+5
<div class="avatar-group">
<img
class="avatar avatar-lg"
src="https://cdn.gufo.dev/stockphotos/1c7a7245.webp"
alt="Sarah Johnson"
/>
<img
class="avatar avatar-lg"
src="https://cdn.gufo.dev/stockphotos/7bd8889a.webp"
alt="Michael Chen"
/>
<img
class="avatar avatar-lg"
src="https://cdn.gufo.dev/stockphotos/a8a338c1.webp"
alt="Emma Wilson"
/>
<span class="avatar-fallback avatar-lg">+5</span>
</div>Avatar groups work well with ratings and labels.
From 200+ reviews
<div class="flex items-center gap-4">
<div class="avatar-group">
<img
class="avatar"
src="https://cdn.gufo.dev/stockphotos/1c7a7245.webp"
alt=""
/>
<img
class="avatar"
src="https://cdn.gufo.dev/stockphotos/7bd8889a.webp"
alt=""
/>
<img
class="avatar"
src="https://cdn.gufo.dev/stockphotos/a8a338c1.webp"
alt=""
/>
<img
class="avatar"
src="https://cdn.gufo.dev/stockphotos/1c7a7245.webp"
alt=""
/>
</div>
<div class="flex flex-col gap-0.5 text-sm">
<div class="flex items-center gap-2">
<div class="flex gap-1">
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="currentColor" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="size-4 text-primary"><path d="M11.525 2.295a.53.53 0 0 1 .95 0l2.31 4.679a2.123 2.123 0 0 0 1.595 1.16l5.166.756a.53.53 0 0 1 .294.904l-3.736 3.638a2.123 2.123 0 0 0-.611 1.878l.882 5.14a.53.53 0 0 1-.771.56l-4.618-2.428a2.122 2.122 0 0 0-1.973 0L6.396 21.01a.53.53 0 0 1-.77-.56l.881-5.139a2.122 2.122 0 0 0-.611-1.879L2.16 9.795a.53.53 0 0 1 .294-.906l5.165-.755a2.122 2.122 0 0 0 1.597-1.16z"/></svg>
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="currentColor" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="size-4 text-primary"><path d="M11.525 2.295a.53.53 0 0 1 .95 0l2.31 4.679a2.123 2.123 0 0 0 1.595 1.16l5.166.756a.53.53 0 0 1 .294.904l-3.736 3.638a2.123 2.123 0 0 0-.611 1.878l.882 5.14a.53.53 0 0 1-.771.56l-4.618-2.428a2.122 2.122 0 0 0-1.973 0L6.396 21.01a.53.53 0 0 1-.77-.56l.881-5.139a2.122 2.122 0 0 0-.611-1.879L2.16 9.795a.53.53 0 0 1 .294-.906l5.165-.755a2.122 2.122 0 0 0 1.597-1.16z"/></svg>
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="currentColor" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="size-4 text-primary"><path d="M11.525 2.295a.53.53 0 0 1 .95 0l2.31 4.679a2.123 2.123 0 0 0 1.595 1.16l5.166.756a.53.53 0 0 1 .294.904l-3.736 3.638a2.123 2.123 0 0 0-.611 1.878l.882 5.14a.53.53 0 0 1-.771.56l-4.618-2.428a2.122 2.122 0 0 0-1.973 0L6.396 21.01a.53.53 0 0 1-.77-.56l.881-5.139a2.122 2.122 0 0 0-.611-1.879L2.16 9.795a.53.53 0 0 1 .294-.906l5.165-.755a2.122 2.122 0 0 0 1.597-1.16z"/></svg>
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="currentColor" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="size-4 text-primary"><path d="M11.525 2.295a.53.53 0 0 1 .95 0l2.31 4.679a2.123 2.123 0 0 0 1.595 1.16l5.166.756a.53.53 0 0 1 .294.904l-3.736 3.638a2.123 2.123 0 0 0-.611 1.878l.882 5.14a.53.53 0 0 1-.771.56l-4.618-2.428a2.122 2.122 0 0 0-1.973 0L6.396 21.01a.53.53 0 0 1-.77-.56l.881-5.139a2.122 2.122 0 0 0-.611-1.879L2.16 9.795a.53.53 0 0 1 .294-.906l5.165-.755a2.122 2.122 0 0 0 1.597-1.16z"/></svg>
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="currentColor" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="size-4 text-primary"><path d="M11.525 2.295a.53.53 0 0 1 .95 0l2.31 4.679a2.123 2.123 0 0 0 1.595 1.16l5.166.756a.53.53 0 0 1 .294.904l-3.736 3.638a2.123 2.123 0 0 0-.611 1.878l.882 5.14a.53.53 0 0 1-.771.56l-4.618-2.428a2.122 2.122 0 0 0-1.973 0L6.396 21.01a.53.53 0 0 1-.77-.56l.881-5.139a2.122 2.122 0 0 0-.611-1.879L2.16 9.795a.53.53 0 0 1 .294-.906l5.165-.755a2.122 2.122 0 0 0 1.597-1.16z"/></svg>
</div>
<span class="font-semibold text-foreground">5.0</span>
</div>
<p class="text-muted-foreground">From 200+ reviews</p>
</div>
</div>Customization
Combine avatar classes with Tailwind utilities for custom styling.

<img
class="avatar rounded-md"
src="https://cdn.gufo.dev/stockphotos/1c7a7245.webp"
alt="Sarah Johnson"
/>
<img
class="avatar size-16 rounded-lg"
src="https://cdn.gufo.dev/stockphotos/1c7a7245.webp"
alt="Sarah Johnson"
/>
<img
class="avatar ring-2 ring-primary ring-offset-2 ring-offset-background"
src="https://cdn.gufo.dev/stockphotos/1c7a7245.webp"
alt="Sarah Johnson"
/>How it works
The avatar component is a CSS-only component that styles images and fallback content. It includes size variants and an avatar group for displaying multiple avatars in a stacked layout.
Structure
An avatar can be either an image or a fallback element:
<!-- Image avatar -->
<img class="avatar" src="..." alt="User" />
<!-- Fallback avatar -->
<span class="avatar-fallback">JD</span>For groups of avatars, wrap them in an .avatar-group container:
<div class="avatar-group">
<img class="avatar" src="..." alt="User 1" />
<img class="avatar" src="..." alt="User 2" />
<span class="avatar-fallback">+3</span>
</div>Class reference
All available classes for the avatar component.
| Class | Description |
|---|---|
avatar | Add to <img> element to apply base avatar styles |
avatar-fallback | Add to <span> element to display initials or an icon when no image is available |
avatar-sm | Add to .avatar or .avatar-fallback for small size |
avatar-base | Add to .avatar or .avatar-fallback for base size (default) |
avatar-lg | Add to .avatar or .avatar-fallback for large size |
avatar-group | Add to container element to stack avatars with overlapping edges |
<img class="avatar avatar-lg" src="..." alt="User" />
<span class="avatar-fallback avatar-sm">AB</span>
<div class="avatar-group">...</div>