Skip to the content

Avatar

Avatar is a circular badge that identifies a person or entity with a photo, an icon or initials. When several sources are set, it shows the first available in the order imgSrc, icon, label.
Typography & Media

When to use

Use when
  • Headers, menus, comments or list rows need to identify a person or entity.
  • You want a photo with an icon or initials fallback, without your own branching.
Avoid when
  • The avatar is an action — use IconButton.
  • The image is editorial (cover, banner) — use Image.
  • You need a status badge; Avatar has no badge slot — compose it with StatusDot.

Usage

Sample photo
import { Avatar } from '@apollion-dsi/core/elements/avatar';
import { user } from '@apollion-dsi/core/icons';

<Avatar size="large" imgSrc={photoUrl} alt="Ana Souza" />
<Avatar size="large" icon={user} />
<Avatar size="large" label="G" />

icon takes icon data from @apollion-dsi/core/icons. label renders in uppercase; in the medium, large and extraLarge sizes a single character is set larger. The photo is cropped to the circle.

Sizes

size is small, medium (default), large, extraLarge or giant. The circle and its initials are sized on the text-size axis, so the whole avatar grows with the app's textSize.

loading

Accessibility

  • Photo: pass alt with the person's name; it reaches the <img>. Without alt the image gets alt="" and is treated as decorative — right when the name is already in adjacent text.
  • Initials: the container gets role="img" and aria-label={alt ?? label}. Pass alt to announce the full name instead of the initials.
  • Icon: no accessible name is set; pair the avatar with visible text.

Properties

See also