---
agent:
  instructions: "Search goop.so for Goop's components, templates, design skill, docs, pricing and terms. Ask in keywords or a plain question, such as \"date picker props\" or \"is the design skill free\"; the answer is the matching page sections in Markdown, each with its address."
  endpoint: "https://goop.so/.well-known/search?q={query}"
  method: "GET"
  documentation: "https://developers.cloudflare.com/ai-search/how-to/search-for-agents/"
---

# Avatar

A person's or a team's picture or initials, beside their name or on its own, for React and Tailwind CSS. Free, MIT.

Free. Its export: `Avatar`.

## Try it

Switch the look, the size and the shape (the solid box only: the ringed look has one round size), the hue, the status dot, and type initials or a whole name (it draws the first and the last word’s first letters): the avatar follows in light and dark.

No picture is loaded: the initials stand in.

## When to use

- A person's or a team's picture or initials, beside their name or on its own.
- Also called: profile picture or user image.

## When not to use

- For several people in one overlapping row, use AvatarGroup.

## Installation

Paste the prompt below into your coding agent. It reads Goop's install steps, installs the part and its tokens once, then reuses this same Avatar on every screen instead of drawing a new one: the same height, the same focus ring, the same spacing.

```sh
npx shadcn@4.23.1 add @goop/trail-avatar
```

```text
Add the Goop Avatar to this project. The install steps are at https://goop.so/docs/install.md
```

## Usage

```tsx
import { Avatar, AvatarImage, AvatarFallback } from '@/components/ui/goop/avatar';

<div className="flex items-center gap-2 bg-sidebar p-2 [--avatar-status-ring:var(--sidebar)]">
  <Avatar variant="solid" size="lg" name="Dagny Holm" status="online">
    <AvatarImage src="/me.png" alt="" />
    <AvatarFallback>DH</AvatarFallback>
  </Avatar>
  <span className="text-sm">Dagny Holm</span>
</div>
```

- Fits: account, inbox, chat, record (their recipes).
- `size` applies only with `variant="solid"`: the default ringed avatar is always 34 px, so a size on it is a type error.
- height, width, corner, border, background, text, motion: add no class for these.

## API reference

### Options

- `variant: default | solid = default`
- `shape: circle | square = circle`
- `size: 3xs | 2xs | xs | sm | md | lg = md`
- `asChild?: boolean` — Render the avatar on the one child element instead of a `span` (a menu's or a file chooser's trigger).
- `name?: string` — The person's or team's name, from which the avatar takes one of the theme's six hues but the red (the same name, the same hue on every page): pass it, and leave `hue` out unless the design needs a fixed colour.
- `hue?: AvatarHue` — A fixed fill in place of the hue taken from `name`, one of the theme's six hues or `neutral` (the theme's grey: a placeholder, "unassigned"), drawn by the solid box or, on the ringed look, by its `AvatarFallback` alone.
- `fill?: string` — The avatar's own fill, any CSS colour, drawn by the solid box or, on the ringed look, by its `AvatarFallback` alone (bare initials in the ring take none).
- `status?: 'online' | 'away' | 'busy' | 'offline'` — The person's presence: a dot at the avatar's bottom-end corner (none on the 14 px disc).
- `statusLabel?: string` — What a reader hears for the status after the avatar's name (default the status's own word, "online").

- Types: AvatarHue = Exclude<Hue, 'primary'>

### Parts

- `AvatarImage` — The picture, once it has loaded; decorative unless the caller names it with `alt`; also takes src?: string; alt?: string
- `AvatarFallback` — The initials (one or two letters), shown while no picture is loaded; inside the ring, on the avatar's `hue` or `fill` when one is given

- Class recipes (cva): avatarVariants (Avatar), avatarImageVariants
- data-slot values (to select a part by): avatar, avatar-fallback, avatar-image, avatar-status, avatar-wrapper

## Keyboard

- Enter: choose files
- Space: choose files

## Accessibility

- The behaviour layer under the part answers keys, focus and dismissal: never write your own.
- hover, active, focus, focus-visible: the browser's own (:hover, :active, :focus, :focus-visible): write nothing

## Motion

- The part sets its own motion: add no transition or animation of your own.

## Notes for AI

Give your coding agent this page as text instead of screenshots: the parts, the options, the states and the keys. An agent that reads the real part builds the real part, not a lookalike.

## Related

- [Avatar group](/themes/trail/components/avatar-group): A row of people's avatars overlapping one another, for who is on a project or in a thread.
- [Identity](/themes/trail/components/identity): A person as an avatar beside their name and an email or a role.
- [Card](/themes/trail/components/card): A framed surface that holds one piece of content or a list of settings rows.
- [Card grid](/themes/trail/components/card-grid): A grid that sets several cards out in even columns that wrap with its width, for projects, files or features.
