Avatar

Avatar

Avatars represent a person or entity with an image or initials. Add size, shape and status modifiers, or wrap several in avatar-group.

Class names

Class nameTypeDescription
avatarComponentRound avatar; works on `<img>` or an element with initials
avatar-squareModifierRounded square instead of a circle
avatar-smSizeSmall
avatar-lgSizeLarge
avatar-onlineStateGreen presence dot; name the status in `aria-label`
avatar-groupPartOverlaps child avatars into a stack

Avatar

Initials need role="img" and an aria-label. For photos use <img class="avatar" alt="...">.

AL
<span class="avatar" role="img" aria-label="Ada Lovelace">AL</span>

Sizes

Medium is the default; there is no avatar-md class.

AL AL AL
<span class="avatar avatar-sm" role="img" aria-label="Ada Lovelace">AL</span>
<span class="avatar" role="img" aria-label="Ada Lovelace">AL</span>
<span class="avatar avatar-lg" role="img" aria-label="Ada Lovelace">AL</span>

Square

GH GH
<span class="avatar avatar-square" role="img" aria-label="Grace Hopper">GH</span>
<span class="avatar avatar-square avatar-lg" role="img" aria-label="Grace Hopper">GH</span>

Online

Put the status in the label so it is not conveyed by color alone.

AL GH
<span class="avatar avatar-online" role="img" aria-label="Ada Lovelace, online">AL</span>
<span class="avatar avatar-lg avatar-online" role="img" aria-label="Grace Hopper, online">GH</span>

Group

AL GH AT +3
<div class="avatar-group" role="group" aria-label="Team members">
  <span class="avatar" role="img" aria-label="Ada Lovelace">AL</span>
  <span class="avatar" role="img" aria-label="Grace Hopper">GH</span>
  <span class="avatar" role="img" aria-label="Alan Turing">AT</span>
  <span class="avatar" role="img" aria-label="3 more members">+3</span>
</div>

With a name

AL
Ada Lovelace
Mathematician
<div style="display: flex; align-items: center; gap: 0.75rem">
  <span class="avatar avatar-online" role="img" aria-label="Online">AL</span>
  <div>
    <strong>Ada Lovelace</strong><br>
    <small>Mathematician</small>
  </div>
</div>