Skip to the content
Konstruktor UI

Surfaces and display

Avatar

A person or an organisation as a small circle: their picture, or their initials. .kui-avatar in four sizes, with an optional status dot; .kui-avatar-group overlaps several.

CSS only

Examples

Initials, a picture, an icon, sizes

Initials are the fallback when there is no picture. An organisation can be a square.

AČ ĐŽ MŠ 王 NĐ
HTML
<span class="kui-avatar kui-avatar--sm" role="img" aria-label="Ana Čolić">AČ</span>
<span class="kui-avatar" role="img" aria-label="Đorđe Živković">ĐŽ</span>
<span class="kui-avatar kui-avatar--lg" role="img" aria-label="Milica Šarić">MŠ</span>
<span class="kui-avatar kui-avatar--xl" role="img" aria-label="王小明">王</span>
<span class="kui-avatar kui-avatar--lg kui-avatar--square" role="img" aria-label="Zastava Inženjering"><svg class="kui-icon" aria-hidden="true"><use href="kit/icons.svg#building-2"></use></svg></span>
<span class="kui-avatar kui-avatar--lg" role="img" aria-label="Nikola Đurić, online">NĐ<span class="kui-avatar__status" aria-hidden="true"></span></span>

A group

The group draws its first child last, so write the “more” avatar first and the people after it in reverse order. The group’s name lists everyone.

HTML
<div class="kui-avatar-group" role="img" aria-label="Ana Čolić, Đorđe Živković, Milica Šarić and 4 more">
  <span class="kui-avatar kui-avatar--more">+4</span>
  <span class="kui-avatar">MŠ</span>
  <span class="kui-avatar">ĐŽ</span>
  <span class="kui-avatar">AČ</span>
</div>

States

Every state

Online: a green dot at the corner, said in the name. No name known: the user icon. A long name has its first two initials only; the full name is the label.

JP KG
HTML
<span class="kui-avatar kui-avatar--lg" role="img" aria-label="Unknown person"><svg class="kui-icon" aria-hidden="true"><use href="kit/icons.svg#user"></use></svg></span>
<span class="kui-avatar kui-avatar--lg" role="img" aria-label="Jovana Petrović, online">JP<span class="kui-avatar__status" aria-hidden="true"></span></span>
<span class="kui-avatar kui-avatar--lg" role="img" aria-label="Karl-Theodor Maria Nikolaus Freiherr von Guttenberg">KG</span>

Classes and attributes

.kui-avatar
The circle. Initials, an <img>, or an icon inside.
--sm, --lg, --xl
Sizes; the default is the height of a control.
--square
A rounded square, for organisations.
--more
The “+4” avatar of a group.
.kui-avatar__status
A green dot at the corner.
.kui-avatar-group
Overlaps avatars; its first child is drawn on the right.

Accessibility

  • An avatar that stands for a person has role="img" and the person’s name; one beside the name already written is aria-hidden.
  • An <img> inside has the person’s name as its alt, or an empty alt when the name is next to it.
  • The status dot is said in the name (“online”), not only shown.
  • A group has one name that lists the people and the count of the rest.

Do and do not

Do

  • Use two initials at most.
  • Use the same avatar for a person everywhere.
  • Show the name next to the avatar where there is room.

Do not

  • Do not use an avatar as the only way to tell people apart.
  • Do not put more than five in a group.
  • Do not use colour alone for the status.