This page as markdown: /avatar.md · Index for agents: /llms.txt · Everything in one file: /llms-full.txt

Avatar

Status: stable

Circular (or square) profile image over Base UI Avatar — automatic image-load tracking with an initials/glyph fallback. Ergonomic Avatar plus low-level AvatarRoot/AvatarImage/AvatarFallback parts, and AvatarGroup for an overlapping stack with a "+N" overflow count.

Keywords: avatar, profile, user, identity, initials, fallback, group, team, stack, overflow, collaborators, facepile, monogram, project mark, workspace icon, org logo, assignee

Usage

Use Avatar to represent a person, team, or account with a compact visual identity. Wrap several in AvatarGroup for collaborators, assignees, or attendees — it overlaps them, rings each in the surface colour, and collapses the rest into a "+N" count; use the low-level parts only when you need custom image/fallback layout.

Best practices

Anatomy

Part Required Description
Root yes The circular frame that clips the image, owns size, and contains image plus fallback.
Image no The loaded profile image, cropped to fill the root.
Fallback yes Initials, a glyph, or short text shown while loading, on error, or when no image exists.
Group no AvatarGroup: the overlapping stack. Sets one size for every avatar and rings each in the surface colour.
Count no AvatarGroupCount: the "+N" avatar ending a group, read as "and N more". Rendered automatically by max/total.

Subcomponents

Name Type Description
AvatarRoot Base UI Avatar.Root props + size + shape + tone + className Low-level circular frame for full composition control — clips the image and holds the size axis. Wraps AvatarImage and AvatarFallback.
AvatarImage Base UI Avatar.Image props + fit?: "cover" | "contain" + className The profile image. Fills and crops the frame, or fits inside it with fit="contain"; hidden by Base UI until it loads.
AvatarFallback Base UI Avatar.Fallback props (delay) + className Shown when no image is available — typically initials or a glyph. Accepts a delay prop.
AvatarGroup { size?: "2xs" | "xs" | "sm" | "md" | "lg"; surface?: "background" | "card" | "popover" | "muted"; max?: number; fit?: boolean; total?: number; countLabel?: (count: number) => string; "aria-label"?: string; className?: string; children: ReactNode } Overlapping stack (role=group) — name it with aria-label ("12 collaborators"). size applies to every avatar inside. max shows that many and collapses the rest into a "+N" count; total is the real head-count when you only pass some people. fit shows only as many avatars as fit the width the group is given (it fills the space left in a flex row) and folds the rest into the count, so a tight row reads "MO SR +5" instead of wrapping. The separating ring reads the inherited --avatar-group-ring (default: the page background); surface sets it to card, popover, or muted.
AvatarGroupCount { count: number; label?: string; size?: "2xs" | "xs" | "sm" | "md" | "lg"; className?: string } The "+N" avatar. Shows "+4" and reads "and 4 more" (override with label). AvatarGroup renders it for you from max/total; use it directly only when composing the stack yourself.

Props

Name Type Default Description
src string — Image source. When omitted, still loading, or failed, the fallback shows.
alt string "" Alt text for the image. Without an image it becomes the avatar's accessible name (role=img), so the initials are never read out as the name.
fallback ReactNode — Initials or a glyph rendered when no image is displayed.
fallbackDelay number — Delay before showing the fallback, in ms — avoids a flash on fast loads.
status ReactNode — A presence indicator pinned to the bottom-end edge, usually . It sits outside the clipped circle and wears a ring in the surface colour (--avatar-group-ring, else the page background). Use this instead of absolutely positioning a dot over an Avatar.
size "2xs" | "xs" | "sm" | "md" | "lg" | "xl" | "2xl" "md" Square footprint: 20px / 24px for compact workspace rows; 32px / 40px / 48px for rows; 96px / 160px for portraits (a profile header, an artist hero, a roster tile). The initials, a status indicator and its cut-out ring scale with it, and at the portrait sizes the photo fades in over the resting surface.
cutout boolean false Ring the avatar in the colour of the surface it sits on (--avatar-group-ring, else the card or section's surface, else the page), so where it overlaps a banner or cover it reads as cut out of it. The ring is 2px at row sizes and thickens with the portrait. Use it instead of ring-* classes on an Avatar.
fit "cover" | "contain" "cover" How the image fills the frame. cover crops it to fill, for a photo. contain fits the whole image inside, for a logo, which then needs no safe area built into the file.
shape "circle" | "square" "circle" The frame's corner. circle is a person. square is what is not a face — a workspace, a project, an org, a team — with a radius from the theme's steps that grows with the size (4px at 20–24px to 20px at 160px), so a square theme stays square. A status indicator sits on the square's corner.
tone "neutral" | "red" | "orange" | "yellow" | "green" | "teal" | "blue" | "purple" | "pink" "neutral" The fallback's colour. neutral is the muted surface; a palette family paints its wash behind the initials and its deep ink on them (a soft Badge's pair, held to contrast in every theme), for a category colour such as one per project. Ignored by variant="art", which colours by seed.
variant "neutral" | "art" "neutral" What the fallback looks like. neutral: initials on the muted surface. art: initials over a two-colour GradientArt (variant="linear") seeded by the person, so each person without a photo gets their own stable colour from the theme.
seed string | number — The art variant's seed. Defaults to the fallback text, then alt, so a person keeps one colour wherever they appear; pass a user id to tell apart two people who share initials.

Variants

Tokens used

muted, muted-foreground, background, card, popover, overlay-foreground

Motion

Accessibility

Related

Examples

With image

import { Avatar } from "@sableui/react"

<Avatar src="/pfp.png" alt="Alex Morgan" fallback="AM" />

Fallback only

import { Avatar } from "@sableui/react"

<Avatar fallback="AM" alt="Alex Morgan" />

Art fallback

import { Avatar } from "@sableui/react"

<Avatar variant="art" fallback="AM" alt="Alex Morgan" />

Sizes

import { Avatar } from "@sableui/react"

<Avatar src="/pfp.png" alt="Alex Morgan" fallback="AM" size="sm" />
<Avatar src="/pfp.png" alt="Alex Morgan" fallback="AM" size="md" />
<Avatar src="/pfp.png" alt="Alex Morgan" fallback="AM" size="lg" />

Profile portrait

import { Avatar, StatusDot } from "@sableui/react"

<div className="flex flex-col items-center gap-3 text-center">
	<Avatar variant="art" size="2xl" fallback="LV" alt="Lena Vale" status={<StatusDot tone="success" />} />
	<div className="flex flex-col gap-1">
		<h1 className="text-heading-1">Lena Vale</h1>
		<p className="text-body-sm text-muted-foreground">1.2M monthly listeners</p>
	</div>
</div>

Dense row sizes

import { Avatar } from "@sableui/react"

<Avatar fallback="EL" alt="Emma Lee" size="2xs" />
<Avatar fallback="EL" alt="Emma Lee" size="xs" />

Project marks

import { Avatar } from "@sableui/react"

<Avatar shape="square" tone="teal" size="xs" fallback="N" alt="Northwind storefront" />
<Avatar shape="square" tone="orange" size="xs" fallback="H" alt="Harbor brand refresh" />
<Avatar shape="square" tone="purple" size="xs" fallback="L" alt="Lumen editorial" />

Low-level parts

import { AvatarFallback, AvatarImage, AvatarRoot } from "@sableui/react"

<AvatarRoot size="lg"><AvatarImage src="/pfp.png" alt="Mara Okafor" /><AvatarFallback>MO</AvatarFallback></AvatarRoot>

Group with overflow

import { Avatar, AvatarGroup } from "@sableui/react"

<AvatarGroup aria-label="6 collaborators" max={3} size="sm" surface="card"><Avatar src="/ana.png" alt="Ana Chen" fallback="AC" /><Avatar src="/mika.png" alt="Mika Lee" fallback="ML" /><Avatar fallback="JL" alt="Jo Lund" /><Avatar fallback="AK" alt="Ari Kim" /><Avatar fallback="SR" alt="Sam Reyes" /><Avatar fallback="MO" alt="Mo Ortiz" /></AvatarGroup>

Group of a larger set

import { Avatar, AvatarGroup } from "@sableui/react"

<AvatarGroup aria-label="12 attendees" total={12} countLabel={(n) => `and ${n} more attendees`}><Avatar fallback="MO" alt="Mo Ortiz" /><Avatar fallback="SR" alt="Sam Reyes" /><Avatar fallback="JL" alt="Jo Lund" /></AvatarGroup>

Composed count

import { Avatar, AvatarGroup, AvatarGroupCount } from "@sableui/react"

<AvatarGroup aria-label="7 reviewers"><Avatar fallback="AC" alt="Ana Chen" /><Avatar fallback="ML" alt="Mika Lee" /><AvatarGroupCount count={5} label="and 5 more reviewers" /></AvatarGroup>

With status

import { Avatar, Entity, StatusDot } from "@sableui/react"

<Entity leading={<Avatar src="/pfp.png" alt="Nova Reed" fallback="NR" status={<StatusDot tone="success" />} />} title="Nova Reed" subtitle="Online" />