component :: Avatar

The .avatar component is a visual representation of a user. It shows the user’s initials or an image thumbnail. Its default size is 56px. (See the HTML section below for all options.)

FileDescriptionSource
component.avatar.cssAll avatar styles (.avatar)Github

Playground

SR

Variation

State

Status

Content

Show
Copied!
<div class="avatar">
<div><span>SR</span></div>
</div>

HTML

Available modifiers

Available modifiersDescription
.avatarDefault - 56px
.avatar + .avatar-smSmall - 24px
.avatar + .avatar-mdMedium - 36px
.avatar + .avatar-lgLarge - 80px
.avatar + .avatar-xlExtra large - 128px
.avatar + .is-onlineUser is online - green dot
.avatar + .is-offlineUser is offline - grey dot

Custom properties

The following custom properties are available in the default theme:

PropertyColor
--avatar-colorText color (when no image).
--avatar-background-colorBackground color (when no image).
--avatar-border-colorBorder color.
--avatar-border-widthBorder width.
--avatar-radiusRadius. (0 = square).
--avatar-status-dot-color-offlineStatus dot color: offline.
--avatar-status-dot-color-onlineStatus dot color: online.

Astro component

PropTypeDefaultDescription
sizestringundefinedsm, md, lg, xl (px values)
imageSrcstringundefinedOptional image.
status'online' | 'offline'undefinedShows a status dot (green online / grey offline)
classstringundefinedAdditional CSS classes, useful for helper classes.

Examples

HTML examples