Skip to content

Avatar

Ada Lovelace AL
<span class="avatar">
<img class="avatar-image" src="" alt="Ada Lovelace" />
</span>
ClassPart
.avatarThe round frame
.avatar-imageThe photo
.avatar-fallbackInitials or an icon when there is no photo
.avatar-badgeA dot pinned to the corner
.avatar-groupOverlapping avatars
.avatar-group-countThe “+3” at the end of a group
AttributeMeaning
data-size="sm"24px
data-size="lg"40px
SM MD LG
AL Online
AL GH MC +3

Set dir="rtl" on the page or on any subtree — the badge moves to the other corner on its own. See the button page for a live example.

  • The photo carries the name. alt="Ada Lovelace", not alt="avatar".
  • Initials are not a name. A fallback showing “AL” needs the full name somewhere — visible text beside it, or .sr-only inside the fallback.
  • A status dot needs words. A green circle says nothing on its own, so put .sr-only text in the badge saying what it means.
  • In a group, the count is text and is announced. Whether that is enough depends on whether the names matter — if they do, list them.