Avatar

A circular user/entity avatar showing an image or initials fallback, with optional presence dot and square variant for projects/apps. A size class is mandatory — the base class sets no dimensions. Use .avatar-group to overlap several avatars (watchers, assignees).

Root: .avatar on <span>

Examples

Example 1
Dana K
<span class="avatar avatar-md"><img src="dana.png" alt="Dana K"></span>
Example 2
JC
<span class="avatar avatar-md avatar-online">JC</span>
Authoring tags — <lz-avatar>
JC P

Authoring source

<lz-avatar presence="online">JC</lz-avatar>
<lz-avatar size="lg" square>P</lz-avatar>

Expands to

<span class="avatar avatar-md avatar-online" data-lz="avatar" data-lz-version="0.1.0">JC</span>
<span class="avatar avatar-lg avatar-square" data-lz="avatar" data-lz-version="0.1.0">P</span>

Authoring tags are macro-expanded to the canonical HTML above at build time (Vite plugin or lz-expand CLI) — the shipped artifact has no runtime.

Contract

Variants & modifiers

ClassAxisRules
avatar-xssizeone required · exclusive
avatar-smsizeone required · exclusive
avatar-mdsizeone required · exclusive
avatar-lgsizeone required · exclusive
avatar-xlsizeone required · exclusive
avatar-onlinepresenceoptional · exclusive
avatar-busypresenceoptional · exclusive
avatar-offlinepresenceoptional · exclusive
avatar-squaremodifieroptional

Structure

SelectorRequiredDescription
imgoptionalOptional photo; fills the avatar with object-fit: cover. Omit it and put 1-2 characters of text content for the initials fallback.

Accessibility

OnAttributeLevelWhen
imgaltrequired

Initials alone don't identify a person to assistive tech; provide the full name via img alt, adjacent visible text, or aria-label on the avatar. Presence dots (online/busy/offline) are color-only ::after pseudo-elements — convey presence in text too where it matters. avatar-group truncation counters ("+4") are plain avatars; label the group, e.g. aria-label="7 watchers".

Nesting

Allowed in:

  • .navbar-actions
  • .issue-card-meta (placed last — it right-aligns via margin-left:auto)
  • .sidebar-header
  • table cells
  • .avatar-group

Never inside (or containing):

  • .avatar

Subcomponents

Avatar-group

Overlapping horizontal stack of avatars, each gaining a surface-colored ring; consecutive avatars overlap by 8px.

Root: .avatar-group on <span>, <div>

Example

Example
AB+4
<span class="avatar-group"><span class="avatar avatar-md">A</span><span class="avatar avatar-md">B</span><span class="avatar avatar-md">+4</span></span>

Structure

SelectorRequiredDescription
.avatarrequiredOne or more .avatar children (each still needs its size class; use the same size for all).

Accessibility

Label the stack as a whole (e.g. aria-label="Watchers: Alex, Bo, Cam and 4 others") rather than relying on per-avatar initials.

Nesting

Allowed in:

  • table cells
  • card meta rows
  • toolbars

Never inside (or containing):

  • .avatar-group