On this page

InstallationAnatomySizesThe nameAn iconWithout the name's colorA logoA pictureA status dotA groupThe countIn the dashboardAccessibilityAPI ReferenceAvatarAvatarGroupAvatarFaceRulesWritten downOpen questions

Avatar

Who something belongs to, as a circle: a person's picture or initials, an icon, or a brand's logo. Alone, or stacked in a group.

MOJWPRLF+1
1<Avatar name="Maya Okafor" />2<AvatarGroup>3  <Avatar name="Jonas Weber" />4  <Avatar name="Priya Raman" />5  <Avatar name="Lucas Ferreira" />6  <Avatar name="Sofia Marchetti" />7</AvatarGroup>

Installation

import { Avatar, AvatarGroup } from "@catalog-developer/components";

Anatomy

A circle in the name's color holding a picture, up to two initials, or an icon; or a neutral gray circle, for a brand's logo or withcolored off. A 1px edge inside the circle sits over all of them: dark in light, light in dark. In a group every avatar takes the group's size, and with the size come the overlap and the 2px gap.

sizeCircleInitialsIcon or logoOverlap in a group
lg36px14.4px18px8px
md32px12.8px16px7px
sm28px11.2px14px6px
xs24px9.6px12px5px
xxs20px8px10px4px
xxxs16px6.4px10px3px

Sizes

Six, named as the Button's: md is 32px, as tall as a medium button. lg and xxxs are the Avatar's own.

MOMOMOMOMOMO
1<Avatar name="Maya Okafor" size="lg" />2<Avatar name="Maya Okafor" />3<Avatar name="Maya Okafor" size="sm" />4<Avatar name="Maya Okafor" size="xs" />5<Avatar name="Maya Okafor" size="xxs" />6<Avatar name="Maya Okafor" size="xxxs" />

The name

The initials and the color are read from the name: the same name is the same color everywhere. One word gives one letter.

MOJWJ
1<Avatar name="Maya Okafor" />2<Avatar name="Jonas Weber" />3<Avatar name="jane@acme.com" />

An icon

What something without initials shows, as a workspace or an organization. The color still comes from the name.

1<Avatar name="Acme" icon={Building} />2<Avatar name="Design preview" icon={Squares} size="xs" />

Without the name's color

colored off: a neutral gray circle, its icon or initials in the secondary text color. For an avatar whose color would say nothing, as an icon standing in for a missing logo.

MO
1<Avatar name="Custom model" icon={Brain} colored={false} />2<Avatar name="Maya Okafor" colored={false} size="xs" />

A logo

A brand's logo from @dome/ds/logos, as a model's provider. It keeps its own colors on the neutral gray circle, whatever colored says. An avatar takes an icon or a logo, never both.

1<Avatar name="Anthropic" logo={AnthropicLogo} />2<Avatar name="OpenAI" logo={OpenAiLogo} size="xs" />

A picture

Until it has loaded, and if it fails, the initials, the icon or the logo show.

MO
1<Avatar name="Maya Okafor" src="/maya.jpg" />

A status dot

The Status dot, on the circle's edge with a gap cut around it. Its size comes from the avatar's; dotPlacement picks the corner.

MOJWPRLF
1<Avatar name="Maya Okafor" dot={{ color: "success" }} />2<Avatar name="Jonas Weber" size="xs" dot={{ color: "warning" }} dotPlacement="bottom-right" />3<Avatar name="Priya Raman" size="xxs" dot={{ color: "error" }} />4<Avatar name="Lucas Ferreira" size="xxxs" dot={{ color: "success" }} />

A group

Each avatar sits over the one before it, which is cut where the next one sits. The gap is empty, so any fill shows through it.

MOJWPR
1<AvatarGroup size="xs">2  <Avatar name="Maya Okafor" />3  <Avatar name="Jonas Weber" />4  <Avatar name="Priya Raman" />5</AvatarGroup>

The count

Three avatars at most, then how many more. total is for a group handed only the first few of a longer list.

MOJWPR+2MOJWPR+10MOJWPR+10
1<AvatarGroup size="xs">{five}</AvatarGroup>2<AvatarGroup size="xs" total={13}>{three}</AvatarGroup>3<AvatarGroup size="xxxs" total={13}>{three}</AvatarGroup>

In the dashboard

Jjane@acme.com

The sidebar's signed-in user

At xxs, before the email. While impersonating, a red border takes the outer 2px and the avatar is xxxs.

components/layout/user-menu.tsx

SAStrict Auditor

A judge's card

At lg, before the judge's name.

components/judges/judge-vote-card.tsx

MOMaya Okafor

A filter value's mark

The Filters size the mark's slot themselves (20px in a menu row, 16 in a chip), so it takes the face alone.

ds/components/filters.tsx

Accessibility

An avatar or a group is decoration: it is hidden from a screen reader, because the name is written beside it. One that stands alone takes aria-label like any element, and is then announced as an image with that name.

The initials are white on the name's color, the same in light and dark: 4.5 to 1 or better for every one of the twenty colors.

API Reference

Avatar

PropTypeDefaultDescription
namestring—Whose it is. The initials and the color are read from it.
srcstring—A picture. Until it has loaded, and if it fails, the initials, the icon or the logo show.
iconIconComponent—An icon in place of the initials, stroke or fill. Not with logo.
logoLogoComponent—A brand's logo in place of the initials, in its own colors, always on the neutral circle. Not with icon.
coloredbooleantrueThe circle in the name's color. Off, a neutral gray, its initials or icon in the secondary text color.
size"lg" | "md" | "sm" | "xs" | "xxs" | "xxxs""md"The circle's diameter. In a group, the group's.
dotStatusDotSpec—A Status dot on the circle's edge, with a gap cut around it: its color, its size (the avatar's gives one), its gap, a pulse.
dotPlacement"top-right" | "bottom-right" | "bottom-left" | "top-left""top-right"The corner the dot sits toward.
tooltipboolean | AvatarTooltip—Shown on hover: on for the name, or the Tooltip's settings (side, delay…) with children in place of the name. In a group with a tooltip, on unless set.

AvatarGroup

PropTypeDefaultDescription
size"lg" | "md" | "sm" | "xs" | "xxs" | "xxxs""md"One size for every avatar in the group. With it come the overlap and the gap.
maxnumber3How many avatars are drawn before the count.
totalnumber—How many there are in all, when the group is handed only the first few.
childrenReactNode—The avatars, each an Avatar. A host that hands faces in (the Filter chip) may give an AvatarFace each: every place in a group has the group's size, and shows the face's name when the group's tooltip is on.
tooltipboolean | Omit<AvatarTooltip, "children">—On, each avatar shows its name on hover and the count lists who it stands for (ten names at most, then how many more). Moving along the stack, the tooltip slides from one to the next.

AvatarFace

The circle alone, filling the box it is given. For a component that sizes its own slot, as a filter value's mark. A screen uses Avatar.

PropTypeDefaultDescription
namestring—Whose it is. The initials and the color are read from it.
srcstring—A picture. Until it has loaded, and if it fails, the initials, the icon or the logo show.
iconIconComponent—An icon in place of the initials, stroke or fill. Not with logo.
logoLogoComponent—A brand's logo in place of the initials, in its own colors, always on the neutral circle. Not with icon.
coloredbooleantrueThe circle in the name's color. Off, a neutral gray, its initials or icon in the secondary text color.
iconSizenumber14The icon's or logo's size in px, since the face does not know its own.

Rules

Written down

The sizes are the Button's

An avatar is as tall as the button of its size: md 32, sm 28, xs 24, xxs 20. lg (36) and xxxs (16) are added at either end.

From ds/README.md (Avatar) and ds/lib/avatar.ts.

A group's gap is cut, never painted

The avatar behind is masked where the next one sits. A ring in a surface's color would show as an edge on any other fill.

From ds/README.md (Avatar) and ds/components/avatar.tsx.

Three avatars, then a count

The count is one more circle, the avatars' size, in a neutral gray. Two digits make it a pill of the same height.

From ds/README.md (Avatar).

The dot is the Status dot

The prop is dot, as on a Button or a Badge. It sits on the circle's edge, top right unless told otherwise, and the avatar is cut around it with a mask, never ringed.

In a group the dot stays whole: it is drawn over the avatars beside it, and they are cut around it as its own avatar is.

From ds/README.md (Avatar) and ds/components/status-dot.tsx.

The initials are read, never typed

name gives the letters and one of twenty colors, the same pick the website makes for that name.

From ds/components/avatar.tsx and ds/lib/avatar-palette.ts.

Open questions

Do words stay beside a group's count?

Open
Ours

The filter chip writes "5 owners" after its avatars today, and draws no count. With the count circle the words may go. Not decided.

Other systems

shadcn's group shows the count circle alone.

Do organizations and workspaces take the Avatar?

Open
Ours

The icon is there for them. The context switcher keeps its own tiles for now.

Other systems

Not compared.

Catalog
Foundations
  • Overview
  • Components
  • Tokens
  • Token usage
  • Typography
  • Icons
Atoms
  • Avatar
  • Badge
  • Button
  • Checkbox
  • Color picker
  • Copy button
  • Icon tooltip
  • Inline code
  • Input
  • Hint
  • Kbd
  • Loader
  • Native select
  • Progress bar
  • Progress ring
  • Radio
  • Select
  • Status dot
  • Switch
  • Text link
  • Textarea
  • Tooltip
  • Truncate
Molecules
  • Accordion
  • Activity chart
  • AI elements
  • Alert
  • Button group
  • Card
  • Code block
  • Combobox trigger
  • Command
  • Content table
  • Context switcher
  • Dropdown menu
  • Empty state
  • Field
  • Field group
  • Filter chip
  • Flow
  • Heading
  • Icon picker
  • Icon flow card
  • Metric card
  • Modal
  • Modal confirmation
  • Pagination
  • Popover
  • Scroll area
  • Sidebar
  • Table
  • Tabs
  • Toggle group
LibraryPublished release