Avatar

Show a person or entity with a photo, icon, initials, or slotted content.

Examples

Properties

PropertyAttributeDescriptionType nameTypeDefault
avatarUrlavatar-urlImage URL; takes precedence over `src` when both are set.string | undefinedstring | undefined—
srcsrcImage URL.string | undefinedstring | undefined—
altTextalt-textImage alternative text; overrides `alt` when set.string | undefinedstring | undefined—
altaltImage alternative text (maps to `<img alt>`).stringstring""
initialsinitialsText shown when there is no slot, image, or `icon`.string | undefinedstring | undefined—
labellabelAccessible name for initials when distinct from visible initials.string | undefinedstring | undefined—
iconiconKey from `@duo/icons` shown when image is absent or fails to load.IconName | undefinedIconName | undefined—
sizesize`xxs` through `xxl` (default `m`); see `MIGRATION.md` for pixel mapping.DuoAvatarSizeDuoIconSize"m"
squaresquareWhen true, corners use small radius; omit or false for a circle or pill shape.booleanbooleanfalse
outlineoutlineMuted border with transparent fill instead of filled surface.booleanbooleanfalse

Slots

NameDescription
defaultCustom content (overrides image, icon, and initials when present).

Usage

Use Avatar to represent a user next to a name, in a list, or as a team or organization logo in a circular or rounded-square frame.

Do

  • Provide alt-text (or alt) on images; use an empty string only when the image is purely decorative.
  • Use label or initials for icon and text fallbacks so screen readers get a name.
  • Pick a size that matches surrounding text (s–m in lists, l+ for profile emphasis).

Don’t

  • Don’t use avatars for large illustrative imagery — use figure or image patterns instead.
  • Don’t use an avatar as the only control for an action — use Button or Icon with an accessible name.

Variants

NamePurpose
filledDefault muted surface (outline omitted).
outlineTransparent fill with border (outline attribute).
squareSmall radius corners; omit for a circular crop.

Sizes

xxs through xxl scale the frame from 16×16px to 64×64px. Default is m (32×32px).