Avatar

An avatar is a visual representation of a user or entity.

<div className="flex items-center gap-4">
  <Avatar src="https://github.com/mehdibha.png" alt="@mehdibha" fallback="M" />
  <Avatar
    src="https://githubbb.com/mehdibha.png" // invalid URL to trigger fallback
    alt="@mehdibha"
    fallback="M"
  />
</div>

Installation

npx shadcn@latest add @dotui/avatar

Usage

Use avatars to represent users or entities with an image or initials.

import { Avatar } from "@/components/ui/avatar";
<Avatar
  src="https://github.com/mehdibha.png"
  alt="@mehdibha"
  fallback="MB"
/>

Playground

Use the controls below to experiment with different avatar props and see the live preview and code update.

size
<Avatar
  src="https://github.com/mehdibha.png"
  alt="@mehdibha"
  fallback="MB"
  size="md"
 />

API Reference

Avatar

Missing description.

PropType
"sm" | "md" | "lg"
ReactNode
string
union
string
string

AvatarGroup

Missing description.

Supports all div attributes.

PropType
"sm" | "md" | "lg"

Last updated on 1/13/2026

Built with passion by @mehdibha.