Avatar

Usage

Avatars are graphic representations of our users and entities in the interface.

Best practices

Do

Use the circular avatar to represent a single user and the rounded square to represent an entity.

Don't

Do not use an avatar to represent diseases, services, or grouping stuff. Instead, consider using text, color, an icon, or any other appropriate component.

Do

Display the user’s or entity’s name close to the avatar when possible, if not, make sure you add an ariaLabel and altText if the avatar is not purely decorative.

Don't

Do not scale or change the shape of the avatars and make sure you use proper variants and sizing for their intended purpose.

Do

Use up to two initials to differentiate users or entities if no image is available.

Don't

When using initials, do not mix avatars that represent the same user types. For instance, use the default for patients and the inverted for doctors.

Do

To keep the proportion and properly frame an avatar use square images or allow the users to crop them into a square.

Don't

Do not use any alternative graphics over avatars, like icons, special characters, or emojis.

Examples

Live Preview

Props

NameDescription Type Default Values
variant
Defines the purpose of the avatar.stringuseruser | entity
size
Determines the size of the avatar.stringmediummedium | large
initials
Shows up to two initials in the avatar.stringnull
inverted
Sets the avatar colors as inverted.booleanfalsefalse | true
image-src
Provides a link to the image.stringnull
alt-text
Use it to describe the image for search engines or sighted users to be written to the page if the image fails.stringnull
aria-label
Use it to describe the image for assistive technologies.string