---
title: "Generated Avatar"
description: "Makes a face or a pattern from a text, such as an email or a user id. The same text always gives the same picture, in your theme colors."
url: https://gelatinui.com/components/generated-avatar
markdown_url: https://gelatinui.com/components/generated-avatar.md
access: free
install: "npx shadcn@latest add @gelatin-ui/generated-avatar"
registry_item: https://gelatinui.com/r/generated-avatar.json
version: "2026-11-15"
index: https://gelatinui.com/llms.txt
docs_index: https://gelatinui.com/docs/llms.txt
---

# Generated Avatar

> Makes a face or a pattern from a text, such as an email or a user id. The same text always gives the same picture, in your theme colors.

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

## When to use it

Best for: A stable, theme-colored face for a person or a thing that has no photo, from an id or an email.

- Pass a user id or an email as `seed`: the same seed always gives the same face.
- Pick a CC0 style from `@dicebear/styles`, such as Lorelei, Glass, or Shapes.
- Put a `GeneratedAvatarImage` in an `AvatarFallback` when a photo can fail.

## When not to use it

- For a real photo or initials only, use an [Avatar](https://gelatinui.com/components/avatar.md).
- For a row of faces with a count, compose this item in an [Avatar Group](https://gelatinui.com/components/avatar-group.md).

## Notes for agents

- Install `@dicebear/styles` next to this item and pass a style JSON as `avatarStyle`.
- Use only CC0 styles (`isFreeAvatarStyle`): a CC BY style needs a visible credit.
- An empty `seed` shows the Avatar user icon on `muted`.
- The default palette uses the chart tokens, light and dark. `palette={null}` keeps the colors of the style.
- Every Avatar prop works: `size`, `rounded`, `inset`, and an `AvatarBadge` as a child.
- `name` is the image `alt`. Leave it out next to a visible name.

## Anatomy

```text
GeneratedAvatar
└─ GeneratedAvatarImage (0..n)
```

## API reference

### GeneratedAvatarImage

| Prop | Type | Default | Description |
| --- | --- | --- | --- |
| `className` | `string` |  |  |
| `seed` | `string` |  | The text that picks the face: a user id or an email. Empty: nothing renders. |
| `avatarStyle` | `GeneratedAvatarStyle` |  | A DiceBear style definition (`import glass from "@dicebear/styles/glass.json"`). |
| `palette` | `GeneratedAvatarPalette \| null` |  | The hues per theme. Default: the chart tokens. `null` keeps the colors of the style. |
| `options` | `GeneratedAvatarOptions` |  | DiceBear options (`flip`, `scale`, a `<part>Variant`); they win over the palette. |
| `alt` | `string` | "" | The name for screen readers. Empty (the default) when a visible name is next to the face. |
| `delay` | `number` | 0 | Waits before the new face comes in, in ms, for a stagger over many faces. |

### GeneratedAvatar

| Prop | Type | Default | Description |
| --- | --- | --- | --- |
| `className` | `string` |  |  |
| `inset` | `boolean` |  |  |
| `rounded` | `"default" \| "full"` |  |  |
| `size` | `"default" \| "lg" \| "sm" \| "xl" \| "xs"` |  |  |
| `seed` | `string` |  | The text that picks the face: a user id or an email. Empty: nothing renders. |
| `avatarStyle` | `Readonly` |  | A DiceBear style definition (`import glass from "@dicebear/styles/glass.json"`). |
| `palette` | `GeneratedAvatarPalette \| null` |  | The hues per theme. Default: the chart tokens. `null` keeps the colors of the style. |
| `options` | `GeneratedAvatarOptions` |  | DiceBear options (`flip`, `scale`, a `<part>Variant`); they win over the palette. |
| `delay` | `number` |  | Waits before the new face comes in, in ms, for a stagger over many faces. |
| `name` | `string` |  | The name for screen readers: on the face, or on the icon when `seed` is empty. |
| `children` | `ReactNode` |  | More parts on top, such as an `AvatarBadge`. |

## Styling

| Part | Slot | States | CSS variables | Tokens |
| --- | --- | --- | --- | --- |
| GeneratedAvatarImage | `generated-avatar-image` | `data-inset` |  |  |
| GeneratedAvatar | `generated-avatar` |  |  |  |

## Usage

Show the photo, and the seeded face when there is no photo or it fails.

```tsx title="member-avatar.tsx"
import lorelei from "@dicebear/styles/lorelei.json";

import { Avatar, AvatarBadge, AvatarFallback, AvatarImage } from "@/components/ui/avatar";
import { GeneratedAvatarImage } from "@/components/ui/generated-avatar";

export function MemberAvatar({ email, photo }: { email: string; photo?: string }) {
  return (
    <Avatar size="lg">
      <AvatarImage src={photo} alt="" />
      <AvatarFallback>
        <GeneratedAvatarImage seed={email} avatarStyle={lorelei} />
      </AvatarFallback>
      <AvatarBadge className="bg-success" />
    </Avatar>
  );
}
```

## Compose

Rules:

- Compose the parts (`compose-parts`): Build each item from its named parts as children, and pass your text and icons in as parts.
- Every state is designed (`every-state`): Give each view of data its loading, empty, and error states: a skeleton in the final layout, an `Empty` with an illustration and one next action, and an error that says what failed and how to retry.

## Add it

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

It adds 13 registry items: 10 files, 2774 lines, and the npm packages `@base-ui/react`, `@dicebear/core`, `@phosphor-icons/react`, `clsx`, `motion`, `tailwind-merge`, `tailwind-variants`.

## Built on

- [Avatar](https://gelatinui.com/components/avatar.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](https://gelatinui.com/components/avatar.md)
- [Avatar Group](https://gelatinui.com/components/avatar-group.md)

## Motion

| Part | Motion |
| --- | --- |
| Swap | popup · a new seed or style pops the new face in while the old one fades out |
