Skip to content

Avatar

Displays a user profile image, initials, or a fallback icon. Unrecognized props (`id`, `tabIndex`, `title`, `data-*`, `aria-*`, event handlers, …) are forwarded to the root `<div>`.

<Avatar name="Ada Lovelace" />
<Avatar
name="Ada Lovelace"
alt="Ada Lovelace"
src="https://i.pravatar.cc/256?img=47"
/>
<div style={{display: 'flex', alignItems: 'center', gap: 16}}>
<Avatar name="Ada Lovelace" size="tiny" />
<Avatar name="Ada Lovelace" size="xsmall" />
<Avatar name="Ada Lovelace" size="small" />
<Avatar name="Ada Lovelace" size="medium" />
<Avatar name="Ada Lovelace" size="large" />
</div>
<div style={{display: 'flex', alignItems: 'center', gap: 16}}>
<Avatar name="Ada Lovelace" status={<AvatarStatusDot label="Online" />} />
<Avatar
name="Grace Hopper"
size="medium"
status={<AvatarStatusDot icon={<Check />} label="Verified" />}
/>
<Avatar
name="Katherine Johnson"
size="large"
status={
<AvatarStatusDot
icon={<Check />}
label="Unavailable"
variant="error"
/>
}
/>
</div>
<Avatar
name="Ada Lovelace"
src="https://broken.example.com/missing.png"
fallbackSrc="https://i.pravatar.cc/256?img=47"
/>
<Avatar name={undefined} src={undefined} />
<div style={{display: 'flex', alignItems: 'center', gap: 16}}>
<Avatar name="Ada Lovelace" size={16} />
<Avatar name="Ada Lovelace" size={24} />
<Avatar name="Ada Lovelace" size={48} />
<Avatar name="Ada Lovelace" size={96} />
<Avatar name="Ada Lovelace" size={144} />
</div>
<div
style={{
display: 'flex',
alignItems: 'center',
gap: 16,
flexWrap: 'wrap',
}}>
{colors.map(color => (
<Avatar color={color} key={color} name={color} size="medium" />
))}
</div>
<div
style={{
display: 'flex',
alignItems: 'center',
gap: 16,
flexWrap: 'wrap',
}}>
<Avatar name="Ada Lovelace" size="medium" />
<Avatar name="Grace Hopper" size="medium" />
<Avatar name="Katherine Johnson" size="medium" />
<Avatar name="Alan Turing" size="medium" />
<Avatar name="Barbara Liskov" size="medium" />
<Avatar name="Dennis Ritchie" size="medium" />
</div>
Unrecognized props (id, tabIndex, title, data-*, aria-*, event handlers) are forwarded to the root element — hover, focus, or inspect the avatar.
<div style={{display: 'flex', alignItems: 'center', gap: 16}}>
<Avatar
aria-describedby="ada-tooltip"
data-analytics="avatar-ada"
id="avatar-ada"
name="Ada Lovelace"
onMouseEnter={() => undefined}
size="medium"
tabIndex={0}
title="Ada Lovelace"
/>
<span id="ada-tooltip">
Unrecognized props (<code>id</code>, <code>tabIndex</code>,{' '}
<code>title</code>, <code>data-*</code>, <code>aria-*</code>, event
handlers) are forwarded to the root element — hover, focus, or inspect
the avatar.
</span>
</div>
<div
className={css({bg: 'bg.subtle'})}
style={{width: 260, height: 320, padding: 12}}>
<SideNav
footer={
<div style={{display: 'flex', alignItems: 'center', gap: 8}}>
<Avatar name="Ada Lovelace" size="small" />
<span>Ada Lovelace</span>
</div>
}>
<SideNavItem href="/home" icon={Home} label="Home" />
<SideNavItem href="/settings" icon={Settings} label="Settings" />
</SideNav>
</div>

Displays a user profile image, initials, or a fallback icon. Unrecognized props (`id`, `tabIndex`, `title`, `data-*`, `aria-*`, event handlers, …) are forwarded to the root `<div>`.

PropTypeDefaultDescription
altstringAccessible text for the avatar image. Defaults to name, then "Avatar".
classNamestringAdditional CSS class names applied to the root element.
color"red" | "orange" | "yellow" | "green" | "teal" | "cyan" | "blue" | "purple" | "pink" | "gray"Surface color for the initials/icon fallback, which also drives the text color. When omitted, a hue is derived deterministically from name (fallbacks without initials use gray).
data-testidstringTest ID applied to the root element.
fallbackSrcstringImage URL to use if src fails to load.
namestringUser name used as fallback accessible text and initials.
refRef<HTMLDivElement>Ref forwarded to the root element.
size"small" | "tiny" | "xsmall" | "medium" | "large" | 16 | 20 | 24 | 32 | 36 | 40 | 48 | 60 | 64 | 72 | 96 | 128 | 144 | 180Avatar size. Named sizes map to the same pixel values as the XDS source. Default is small.
srcstringPrimary image URL.
statusReactNodeCorner content, usually an AvatarStatusDot.
styleCSSPropertiesInline styles applied to the root element.

Size-aware status indicator dot rendered in the corner of an Avatar.

PropTypeDefaultDescription
classNamestringAdditional CSS class names applied to the root element.
data-testidstringTest ID applied to the root element.
iconReactNodeOptional icon rendered inside medium and large dots.
label*stringAccessible label describing the status, such as "Online".
refRef<HTMLDivElement>Ref forwarded to the root element.
styleCSSPropertiesInline styles applied to the root element.
variant"error" | "success" | "neutral"Semantic dot color. Default is success.