---
title: "Avatar"
description: "Shows a person or a workspace as a photo, initials, or an icon. Initials show while the photo loads, and a small badge can show if the person is online."
url: https://gelatinui.com/components/avatar
markdown_url: https://gelatinui.com/components/avatar.md
access: free
install: "npx shadcn@latest add @gelatin-ui/avatar"
registry_item: https://gelatinui.com/r/avatar.json
version: "2026-11-08"
index: https://gelatinui.com/llms.txt
docs_index: https://gelatinui.com/docs/llms.txt
---

# Avatar

> Shows a person or a workspace as a photo, initials, or an icon. Initials show while the photo loads, and a small badge can show if the person is online.

Page: https://gelatinui.com/components/avatar

## When to use it

Best for: A picture of a person or a workspace: an image, initials, or an icon.

- Compose `AvatarImage` and `AvatarFallback`, so a broken photo shows initials. For a person, put `personInitials(name)` in the fallback.
- Use `AvatarGroup` for a stack: the avatars take its `size` and `rounded`.
- Use `inset` for a logo or a site icon on a muted fill.

## When not to use it

- For a short status word, use a [Badge](https://gelatinui.com/components/badge.md).

## Notes for agents

- It is not interactive. To open a menu, render it inside a Button, which owns the focus ring and the 44px target.
- Next to a visible name, use `alt=""` and `aria-hidden` on the fallback. Alone, put the name in `alt`.
- Two initials do not fit at `xs` (20px): use one.

## Anatomy

```text
Avatar
├─ AvatarImage (0..n)
├─ AvatarFallback (0..n)
├─ AvatarBadge (0..n)
├─ AvatarGroup (0..n)
└─ AvatarGroupCount (0..n)
```

## API reference

### Avatar

| Prop | Type | Default | Description |
| --- | --- | --- | --- |
| `inset` | `boolean` | false |  |
| `rounded` | `"default" \| "full"` |  |  |
| `size` | `"default" \| "lg" \| "sm" \| "xl" \| "xs"` |  |  |
| `className` | `string` |  |  |

### AvatarImage

| Prop | Type | Default | Description |
| --- | --- | --- | --- |
| `className` | `string` |  |  |
| `plain` | `boolean` | false | A plain `<img>` over the fallback, with no load state (only `src`, `alt`, and `ref` pass), for a virtual list that mounts avatars on each scroll frame. A failed photo shows the fallback. |

Also takes every prop of Base UI `Avatar.Image`: https://base-ui.com/react/components/avatar

### AvatarFallback

| Prop | Type | Default | Description |
| --- | --- | --- | --- |
| `className` | `string` |  |  |

Also takes every prop of Base UI `Avatar.Fallback`: https://base-ui.com/react/components/avatar

### AvatarBadge

| Prop | Type | Default | Description |
| --- | --- | --- | --- |
| `status` | `"away" \| "busy" \| "default" \| "offline" \| "online"` |  |  |

## Styling

| Part | Slot | States | CSS variables | Tokens |
| --- | --- | --- | --- | --- |
| Avatar | `avatar` | `data-ending-style`, `data-error`, `data-loading`, `data-popup-open`, `data-starting-style` |  | `hit-area`, `motion-timing` |
| AvatarImage | `avatar-image` | `data-ending-style`, `data-error`, `data-loading`, `data-popup-open`, `data-starting-style` |  | `hit-area`, `motion-timing` |
| AvatarFallback | `avatar-fallback` | `data-ending-style`, `data-error`, `data-loading`, `data-popup-open`, `data-starting-style` |  | `hit-area`, `motion-timing` |
| AvatarBadge | `avatar-badge` | `data-ending-style`, `data-error`, `data-loading`, `data-popup-open`, `data-starting-style` |  | `hit-area`, `motion-timing` |
| AvatarGroup | `avatar-group` |  |  |  |
| AvatarGroupCount | `avatar-group-count` | `data-ending-style`, `data-error`, `data-loading`, `data-popup-open`, `data-starting-style` |  | `hit-area`, `motion-timing` |

## Usage

Pass an image and a fallback.

```tsx title="user-avatar.tsx"
import { Avatar, AvatarFallback, AvatarImage } from "@/components/ui/avatar";

export function UserAvatar() {
  return (
    <Avatar>
      <AvatarImage src="/photos/diego.webp" alt="Diego Ruiz" />
      <AvatarFallback>DR</AvatarFallback>
    </Avatar>
  );
}
```

## Compose

Build it with:

- [Sidebar](https://gelatinui.com/components/sidebar.md): Holds the groups of links and collapses to icons.
- [Badge](https://gelatinui.com/components/badge.md): Shows a count next to a link.
- [Menu](https://gelatinui.com/components/menu.md): Holds the account and workspace actions.

Rules:

- Steady text weight (`steady-weight`): Never change the font weight on hover, focus, selected, active, or open; change the color or the fill, so the text does not jump.
- Color has a job (`color-has-a-job`): Use color only for a status, the brand action, or data; keep the rest neutral, and show a level with a small mark (a dot, a tinted badge) before a big fill.
- Touch targets (`touch-targets`): Give every control a hit area of at least 44 px on touch screens, even when it looks smaller.
- Compose the parts (`compose-parts`): Build each item from its named parts as children, and pass your text and icons in as parts.

Patterns: `gelatin://patterns/app-sidebar`

## Add it

```bash
npx shadcn@latest add @gelatin-ui/avatar
```

It adds 7 registry items: 4 files, 1513 lines, and the npm packages `@base-ui/react`, `clsx`, `tailwind-merge`, `tailwind-variants`.

## Built on

- [Dot](https://gelatinui.com/components/dot.md)

## For AI agents

- Every item, one file: https://gelatinui.com/llms.txt
- MCP server (`search_items`, `get_item`, `get_install_plan`): https://gelatinui.com/mcp

## Related

- [Avatar Group](https://gelatinui.com/components/avatar-group.md)
- [Badge](https://gelatinui.com/components/badge.md)
- [Menu](https://gelatinui.com/components/menu.md)

## Accessibility

The name comes from `alt` on the image. Next to a visible name, leave it empty.

An `AvatarGroup` of decoration takes `aria-hidden`.

## Motion

| Part | Motion |
| --- | --- |
| Image | fade · the image fades in when it loads |
