Skip to content

Avatar ​

A graphical representation of a user or entity, rendered from an image, initials, or a fallback image.

TIP

When neither src nor label is provided, a default fallback image is rendered.

Basic Usage ​

<bo-avatar label="Avatar" />
<bo-avatar src="../../assets/avatar.jpeg" />
<bo-avatar />

Variants ​

<bo-avatar label="Primary" variant="primary" />
<bo-avatar label="Secondary" variant="secondary" />
<bo-avatar label="Destructive" variant="destructive" />
<bo-avatar label="Warning" variant="warning" />
<bo-avatar label="Success" variant="success" />
<bo-avatar label="Dark" variant="dark" />

Sizes ​

<bo-avatar label="XS" size="xs" />
<bo-avatar label="SM" size="sm" />
<bo-avatar label="Default" size="default" />
<bo-avatar label="LG" size="lg" />
<bo-avatar label="XL" size="xl" />

Shapes ​

Use the kind prop to control the shape of the avatar.

<bo-avatar label="Default" kind="default" />
<bo-avatar label="Flat" kind="flat" />
<bo-avatar label="Circle" kind="circle" />
<bo-avatar label="Outline" kind="outline" />
<bo-avatar label="Outline Flat" kind="outline-flat" />
<bo-avatar label="Outline Circle" kind="outline-circle" />

Indicators ​

Use indicatorKind to display a status indicator on the avatar.

<bo-avatar label="Online" indicator-kind="online" />
<bo-avatar label="Offline" indicator-kind="offline" />
<bo-avatar label="Busy" indicator-kind="busy" />
<bo-avatar label="Away" indicator-kind="away" />

Indicator Position ​

Use indicatorPosition to place the indicator. Defaults to top-right.

<bo-avatar label="TL" indicator-position="top-left" indicator-kind="online" />
<bo-avatar label="TR" indicator-position="top-right" indicator-kind="offline" />
<bo-avatar label="BL" indicator-position="bottom-left" indicator-kind="busy" />
<bo-avatar label="BR" indicator-position="bottom-right" indicator-kind="away" />

Custom Colors ​

Use customColor and customTextColor for arbitrary colors. Accepts hex, RGB/RGBA, OKLCH, or CSS variables.

<bo-avatar label="CB" custom-color="#880808" custom-text-color="#FFFFFF" />
<bo-avatar label="CB" custom-color="rgb(34, 197, 94)" custom-text-color="#FFFFFF" />
<bo-avatar label="CB" custom-color="oklch(84.5% 0.143 164.978)" custom-text-color="#000000" />
<bo-avatar label="OL" kind="outline" custom-color="oklch(84.5% 0.143 164.978)" />

Cursor ​

<bo-avatar label="cursor-auto" cursor="cursor-auto" />
<bo-avatar label="cursor-pointer" cursor="cursor-pointer" />
<bo-avatar label="cursor-not-allowed" cursor="cursor-not-allowed" />

API Reference ​

Props ​

PropTypeDefaultDescription
idstringAutogeneratedThe id of the element.
dataTestIdstringAutogeneratedThe data test id of the element.
labelstring-The initials label of the avatar.
srcstring-The image URL for the avatar.
altstring-The alt text for the avatar image.
kindBoAvatarKind'default'The shape of the avatar.
sizeBoAvatarSize'default'The size of the avatar.
cursorBoCursorcursor-autoThe cursor style of the avatar.
variantBoAvatarVariant'primary'The color variant of the avatar.
customColorstring-Custom background color for the avatar.
customTextColorstring-Custom text color for the avatar.
indicatorKindBoAvatarIndicatorKind'none'The status indicator type.
indicatorPositionBoAvatarIndicatorPosition'top-right'The position of the indicator.
roleHTMLAttributes['role']-The role of the element.
ariaLabelHTMLAttributes['aria-label']-Defines a string value that labels the current element.

Released under the MIT License.