Avatar

A person or a company, as a mark. Every avatar is either named or explicitly decorative, so it is never announced as bare initials or as nothing at all.

Reach for it

Standing for a person or a company, with a fallback that still has a name.

Not for

Decoration. An avatar with no accessible name is announced as nothing.

Sizes, shapes and fallbacks

The accessible name sits on the root rather than the image, so what a screen reader hears does not change depending on whether the image loaded. Sizes are variants rather than a number, so no caller can render a size nobody designed. Use isDecorative when the name is already beside the mark.

Jeanne Dupont, named beside the mark, so the mark stays silent
A face fills the box, so fit="cover" crops the sidesA logo is not a face, so fit="contain" keeps the whole mark

API reference

Avatar

PropTypeDefaultDescription
name*string-Who the avatar stands for, e.g. "Mooncard SAS". Announced in place of the image.
fallback*string-Shown whenever the image is not on screen. Usually initials. Never generated here.
data-testidstring-Names the element for a test. Never rendered, never announced.
size'small' | 'medium' | 'large'medium
shape'circle' | 'square'circle
tone'neutral' | 'brand' | 'info'neutral
fit'cover' | 'contain'coverHow the image sits in the box. `cover` fills it and crops, which is right for a face. A company logo is not a face: cropping cut the mark, and a logo with a transparent background sat straight on the grey initial surface. `contain` fits the whole mark, insets it, and puts it on the plain page surface, which is what the logo was drawn for.
isDecorativefalse-
srcstring-Omitted, empty or failing to load all show the fallback.