npx shadcn@4.23.1 add @goop/meadow-avatarAvatar
FreeA person's or a team's picture or initials, beside their name or on its own, for React and Tailwind CSS. Free, MIT.
What an agent sees
- AvatarImageThe picture, once it has loaded
- AvatarFallbackThe initials (one or two letters), shown while no picture is loaded
- AvatarUploadA picture a person changes
import { useState } from 'react';
import { Avatar, AvatarFallback, AvatarImage, AvatarUpload } from '@/components/ui/goop/avatar';
function FieldTeam() {
return (
<div className="flex items-center gap-3 rounded-lg bg-sidebar p-2 [--avatar-status-ring:var(--sidebar)]">
<Avatar name="Dagny Holm" status="online">
<AvatarImage src="/people/dagny.png" alt="" />
<AvatarFallback>Dagny Holm</AvatarFallback>
</Avatar>
<Avatar variant="solid" size="lg" name="Bilal Rashed">
Bilal Rashed
</Avatar>
<Avatar variant="solid" shape="square" size="sm" name="Fieldwork">
Fieldwork
</Avatar>
<span className="text-sm">Dagny, Bilal and the Fieldwork team</span>
</div>
);
}
function ProfilePicture() {
return (
<Avatar variant="solid" size="xl" name="Dagny Holm">
<AvatarImage src="/people/dagny.png" alt="Dagny Holm" />
<AvatarFallback>Dagny Holm</AvatarFallback>
</Avatar>
);
}
function WorkspacePicture() {
const [picture, setPicture] = useState<File | null>(null);
return (
<div className="flex flex-col gap-2">
<AvatarUpload hue="neutral" aria-label="Change the Fieldwork picture" onFileChange={setPicture}>
Fieldwork
</AvatarUpload>
<span className="text-sm text-muted-foreground">{picture ? picture.name : 'A square image fits best'}</span>
</div>
);
}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.
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.
npx shadcn@4.23.1 add @goop/meadow-avatarAdd the Goop Avatar to this project. The install steps are at https://goop.so/docs/install.mdUsage
import { useState } from 'react';
import { Avatar, AvatarFallback, AvatarImage, AvatarUpload } from '@/components/ui/goop/avatar';
function FieldTeam() {
return (
<div className="flex items-center gap-3 rounded-lg bg-sidebar p-2 [--avatar-status-ring:var(--sidebar)]">
<Avatar name="Dagny Holm" status="online">
<AvatarImage src="/people/dagny.png" alt="" />
<AvatarFallback>Dagny Holm</AvatarFallback>
</Avatar>
<Avatar variant="solid" size="lg" name="Bilal Rashed">
Bilal Rashed
</Avatar>
<Avatar variant="solid" shape="square" size="sm" name="Fieldwork">
Fieldwork
</Avatar>
<span className="text-sm">Dagny, Bilal and the Fieldwork team</span>
</div>
);
}
function ProfilePicture() {
return (
<Avatar variant="solid" size="xl" name="Dagny Holm">
<AvatarImage src="/people/dagny.png" alt="Dagny Holm" />
<AvatarFallback>Dagny Holm</AvatarFallback>
</Avatar>
);
}
function WorkspacePicture() {
const [picture, setPicture] = useState<File | null>(null);
return (
<div className="flex flex-col gap-2">
<AvatarUpload hue="neutral" aria-label="Change the Fieldwork picture" onFileChange={setPicture}>
Fieldwork
</AvatarUpload>
<span className="text-sm text-muted-foreground">{picture ? picture.name : 'A square image fits best'}</span>
</div>
);
}- Fits: account, frame, inbox (their recipes).
sizeapplies only withvariant="solid": the default avatar is always 24 px, so a size on it is a type error.- AvatarUpload: For a menu of the picture's actions (upload, remove), wear the Avatar
asChildon abuttonas aDropdownMenuTrigger's child instead, as the profile cover does. - height, width, corner, border, background, shadow, text, motion: add no class for these.
API reference
| Option | Type | What it does |
|---|---|---|
| variant | default | solid = default | |
| shape | circle | square = circle | |
| size | 3xs | 2xs | xs | sm | md | lg | xl | settings = md | |
| asChild? | boolean | Render the avatar on the one child element instead of a span (a person's menu's or a picture chooser's trigger). |
| name? | string | The person's or team's name, from which the avatar takes one of the theme's six fills, never the error red (the same name, the same fill on every page): pass it, and leave hue out unless the design needs a fixed colour. |
| hue? | 'blue' | 'green' | 'orange' | 'pink' | 'red' | 'yellow' | 'neutral' | |
| fill? | string | The avatar's own fill, any CSS colour, drawn by the solid box or, on the default look, by its AvatarFallback alone. |
| 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"). |
| Part | What it is |
|---|---|
| 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 default circle, on the avatar's hue, fill or the colour taken from its name |
| AvatarUpload | A picture a person changes |
- Class recipes (cva): avatarVariants (Avatar), avatarImageVariants
- data-slot values (to select a part by): avatar, avatar-fallback, avatar-image, avatar-status, avatar-wrapper
Accessibility
- The behaviour layer under the part answers keys, focus and dismissal: never write your own.
- active, focus-visible: the browser's own (:active, :focus-visible): write nothing
Its states are drawn from attributes and props, so assistive technology and your agent read the same thing:
| State | Drawn by |
|---|---|
| disabled | the prop disabled |
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.