Skip to content
A graphical representation of a user or entity - usually a photo or initials
  • Shows initials if no image source is provided.
  • Generates a background color if no image source is provided.
  • Prevents content flashing by checking if the image source exists.

At Pleo, we primarily use avatars to represent a user, either with a profile picture or initials if a picture hasn't been provided. We also use them to represent merchants in expenses or subscriptions.

The component comes in a few different sizes.

JR
JR
JR
JR

In some cases we show an icon inside the avatar. An example of this is when we're representing merchants in expenses or subscriptions.

When using only an icon inside the Avatar, be sure to set the aria-label prop to support users who rely on screen readers.

If the image of the avatar fails to load, we show a fallback based on the provided name. The name is used to generate initials and a background color from a limited palette.

JR

We show an outline around avatars when stacked in an AvatarGroup or simply to create contrast when presented on a none white background.

JR

A disabled version of the avatar can be used e.g. when a user has been deactivated, indicating that their profile is inactive and preventing any confusion about their current status.

JR

A placeholder avatar can be used when data is unavailable, such as when an employee is invited to join a company in Pleo but has not yet onboarded. In this case, the placeholder prevents confusion by indicating that a profile exists but is not yet fully set up.

A companion component used to show an icon badge on top of an avatar. We use this in expenses to show categories or to reflect a private or pending purchase.

While the badge can be used with all avatar sizes, it's only intended used for larger avatars as it will otherwise overlay too much of the avatar itself.

JR

In some cases, you may want a badge to stand out if it's meant to communicate something of urgency or prominence. That can be done with a variant.

JR

We sometimes wrap a badge in an overlay to explain its meaning. In such cases, the badge should be rendered as a button to make it accessible.

JR

A companion component used to show a group/list of avatars.

JR
NP

If a size is provided to the avatar group, it will automatically be propagated down to the individual avatars within it.

JR
NP

If you're working with dynamic data, it's possible to limit the amount of avatars shown. Additional avatars will be represented with an excess number component.

JR
NP
+1

We sometimes show avatars stacked on top of each other if there's limited horizontal space and/or it's more relevant how many people there are than precisely who they are.

JR
NP
+1