Skip to content

Avatar

Displays a user or object avatar, supporting both text-placeholder and image forms.

Basic Usage

Text avatars

ABCD

A text avatar renders the first character of its content; with no content at all, it shows a ? placeholder.

Sizes

Size variants

ABCDE

Image Avatars

Image avatars

Avatar Groups

Avatar group

AB

Multiple oas-avatar elements wrapped in oas-avatar-group are laid out left-to-right with overlapping.

Max display count

ABC

When max is set, the overflow is hidden and a +N count badge is shown at the end.

Unified Size

size sets the size of all avatars in the group (px) so it does not need to be set per avatar; combined with max, the +N count badge adapts its size accordingly.

Unified size size

ABABCD

Empty Fallback

Empty fallback

M

API

oas-avatar

AttributeDescriptionTypeDefault
altAlternative text for the image
sizeAvatar size (px)string32
srcImage URL; renders an image avatar when presentstring

oas-avatar-group

AttributeDescriptionTypeDefault
maxMax number of avatars shown; overflow shows a +N count badgestring
sizeUnified avatar size (px); the count badge adaptsstring
NameDescription
default

Note: alt is read on first render and is not in the observed attribute list; dynamic changes require a manual re-render.