Skip to main content

Avatar

Avatar: Avatar Component shadow

The avatar element is used to visually represent a user or entity. It is usually used as a wrapper and provides a convenient way to display profile pictures, icons, or, if these are not provided, initials. It supports a variety of configurations including size, grouping multiple avatars, or displaying a dropdown when clicked or a tooltip when pointed to with the mouse.

Basic usage

Avatar size

The size property determines the size of the avatar. Setting this property will change the internal offset of the button.

Avatar with icon

Nesting the wj-icon element will display the selected icon inside the avatar.

Avatar with initials

By adding the initials and label properties, the avatar displays the initials of the selected value of the label property.

Avatar with dropdown

Adding the wj-dropdown element will display a menu when the avatar is clicked. In this case, you need to add a trigger slot with value hover to the avatar element.

Avatar with tooltip

Adding the wj-dropdown element will display a menu when the avatar is clicked.

Group of avatars

CSS Custom Properties

Attributes and Properties

initials

DescriptionIf true, the avatar displays the initials of the label attribute value
Attributeinitials
Typeboolean
Defaultfalse

label

DescriptionSpecifies the value for the initials attribute
Attributelabel
Typestring
Defaultundefined

size

DescriptionSet to small for a smaller avatar and to large for a larger avatar. By default, the size is unset.
Attributesize
Type"large" | "small" | "undefined"
Defaultfalse

Events

No events available for this component.

Methods

No public methods available for this component.

CSS Shadow Parts

NameDescription
nativeRefers to the div element inside the avatar

CSS Custom Properties

NameDescription
--wj-avatar-background-colorAvatar background colour
--wj-avatar-border-colorAvatar border colour
--wj-avatar-border-radiusRounding of the edge of the avatar
--wj-avatar-border-styleAvatar border style
--wj-avatar-border-widthEdge width
--wj-avatar-colorText colour
--wj-avatar-font-sizeFont size
--wj-avatar-font-weightFont thickness
--wj-avatar-heightHeight of avatar
--wj-avatar-widthWidth of avatar

Slots

No slots available for this component.