ComponentsAvatar

Avatar

Avatars can be used to represent a user or a brand. They can show an image, an icon or the initial letters of a name, for example.

GitHub LogoSource Code
xssmmdlgxl

Image Avatars

Image avatars can be created by passing the src or srcSet props to the component.

Ben
Beatrice
Wayne
Clara Soul

Letter Avatars

Avatars containing simple characters can be created by passing a string as children.

BM
W
CS

Icon Avatars

Icon avatars are created by passing an icon as children. Its size and color aren’t Avatar’s responsibility.

Fallbacks

If there is an error loading the avatar image, the component falls back to an alternative in the following order: the provided children, the first letter of the alt text and finally the generic User icon.

Clara Soul
Clara Soul

Variants

You can configure the size and variant of an avatar. When using an icon, set its iconSize to the size immediately below the avatar size.

NA
Beatrice
Beatrice

Status

An avatar can have a status, represented by either the status colored border or by the badge dot. The color can be from the theme palette or custom.

AB
AB
AB
AB
AB

Actions

An avatar should be interacted with by wrapping it in an interactable element, such as an HvButton or a link. Make sure the elements are labelled accordingly.