---
title: "Avatar"
description: "A user avatar with an image and a fallback for initials or an icon while the image loads or fails. Built on Base UI."
plan: Free
docs: https://ui.edbn.me/docs/components/avatar
---

# Avatar

A user avatar with an image and a fallback for initials or an icon while the image loads or fails. Built on Base UI.

## Installation

```bash
npx shadcn@4.19.0 add https://ui.edbn.me/r/avatar.json
```

## Dependencies
- npm: @base-ui/react@^1.8.0
- edbn: edbn-base

## Usage

```tsx examples/avatar-basic.tsx
"use client";
import { Avatar, AvatarBadge, AvatarFallback } from "@/components/ui/avatar";

export default function AvatarBasicPreview() {
  return (
    <Avatar className="size-12">
      <AvatarFallback>ED</AvatarFallback>
      <AvatarBadge />
    </Avatar>
  );
}
```

## Files
- components/ui/avatar.tsx (112 lines)

## For agents
- Base theme, once per project: npx shadcn@4.19.0 add https://ui.edbn.me/r/edbn-base.json
- MCP server with search, items, examples and source: https://ui.edbn.me/mcp
- Every page and item: https://ui.edbn.me/llms.txt
