Skip to content

Avatar

The Avatar component is used to represent people or entities by displaying images, initials, or icons.

Basic Usage

Avatar styles can be defined through the size, shape, backgroundColor, borderRadius, fallbackText, and icon properties.

Size

Avatars come in 7 preset sizes: xs, sm, md, lg, xl, 2xl, 3xl. The default size is md.

Shape

There are two types of Avatars: circle, and square. The default type is circle.

Background Color

The backgroundColor attribute allows you to set the background color of the avatar.

Border Radius

The borderRadius attribute allows you to set the border radius of the avatar.

Fallback Text

The fallbackText attribute allows you to display a fallback text if the image fails to load.

Icon

The icon attribute allows you to display an icon instead of an image.

Outlined

The outlined attribute allows you to display an outlined avatar.

Avatar Group

Avatar Group is used to display a group of avatars in a single component.It is particularly suitable for displaying a group of people or entities in a compact and visually appealing way.

Attributes

AttributeDescriptionTypeDefault
srcImage URLstring-
altAlternative text for imagestring-
initialsInitials to show when no imagestring-
iconIcon name to displaystring-
fallbackContentFallback contentstring-
sizeAvatar size, can be xs, sm, md, lg, xl, 2xl, 3xlstring | numbermd
shapeAvatar shape, can be circle or squarestringcircle
backgroundColorBackground colorstring#101
borderRadiusCustom border radiusstring / number-
outlinedWhether avatar is outlinedbooleanfalse
outlineColorOutline colorstring#ccc
outlineWidthOutline widthnumber3
outlineStyleOutline style, can be solid or gradientstringsolid
outlineGradientOutline gradientstringlinear-gradient(45deg, #3b82f6, #8b5cf6)
clickableWhether avatar is interactivebooleanfalse
ariaLabelARIA label for accessibilitystring-

Avatar Group

AttributeDescriptionTypeDefault
overlapOverlap size between avatarsstring30

Events

NameDescriptionParameters
clickTriggered when clicked (only if clickable is true)(event: MouseEvent)
errorTriggered when image fails to load-