Skip to content

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.)

File Description Source
component.avatar.css All 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 modifiers Description
.avatar Default - 56px
.avatar + .avatar-sm Small - 24px
.avatar + .avatar-md Medium - 36px
.avatar + .avatar-lg Large - 80px
.avatar + .avatar-xl Extra large - 128px
.avatar + .is-online User is online - green dot
.avatar + .is-offline User is offline - grey dot

Custom properties

The following custom properties are available in settings.ui.css:

Property Color
--avatar-color Text color (when no image).
--avatar-background-color Background color (when no image).
--avatar-border-color Border color.
--avatar-border-width Border width.
--avatar-radius Radius. (0 = square).
--avatar-status-dot-color-offline Status dot color: offline.
--avatar-status-dot-color-online Status dot color: online.

Astro component

Prop Type Default Description
size string undefined sm, md, lg, xl (px values)
imageSrc string undefined Optional image.
status 'online' | 'offline' undefined Shows a status dot (green online / grey offline)
class string undefined Additional CSS classes, useful for helper classes.

Examples

HTML examples