# Avatar

> User avatar. Pass `seed` for a generated Oreo face, or compose Image + Fallback.

Registry name: `avatar`. HTML docs: https://ui.anuragroy.dev/component/avatar.

## Install

```bash
npx shadcn@latest add https://ui.anuragroy.dev/r/avatar.json
```

If the website is down: `npx shadcn@latest add https://raw.githubusercontent.com/anurag-roy/ui.anuragroy.dev/main/public/r/avatar.json`.

Registry JSON: https://ui.anuragroy.dev/r/avatar.json (GitHub: https://raw.githubusercontent.com/anurag-roy/ui.anuragroy.dev/main/public/r/avatar.json).

## Import

Import paths follow the consumer `components.json` aliases. After a default install:

```tsx
import {
  Avatar,
  AvatarFallback,
  AvatarImage
} from "@/components/ui/avatar"
```

## Usage

```tsx
import { Avatar } from "@/components/ui/avatar"

export function Example() {
  return <Avatar seed="Ada Lovelace" size={40} title="Ada Lovelace" />
}
```

## API

### Avatar

Without children, generates an Oreo avatar from `seed`. With children, acts as a Base UI Avatar root.

| Prop | Type | Default | Description |
| --- | --- | --- | --- |
| `seed` | string | — | Drives palette and variant. |
| `palette` | string | — | Oreo palette name, e.g. `rose-milk`. |
| `variantId` | string | — | Locks a specific Oreo face when not using `seed`. |
| `tone` | AvatarOptions['tone'] | — | Oreo tone override. |
| `appearance` | "light" \| "dark" | — | Defaults to the active theme from `next-themes`. |
| `drift` | number | — | Palette drift. Seeded avatars default to `8`. |
| `size` | number | 40 |  |
| `title` | string | — | Accessible name for the generated SVG. |

## Notes

- Generated avatars use `@oreo-design/avatar` and follow the active light/dark theme.

## See also

- [HTML page](https://ui.anuragroy.dev/component/avatar): Preview and the same docs in the site chrome.
- [Registry item](https://ui.anuragroy.dev/r/avatar.json): Source files and dependencies.
- [Catalog](https://ui.anuragroy.dev/component): All components.
- [llms.txt](https://ui.anuragroy.dev/llms.txt): Agent index for this library.
