Skip to content

Avatar

A round surface with a picture or initials. The component says nothing about who the person is: the text next to it does that, or a text you give the picture.

AttributeEffect
data-size="small"For a table row or a list
(omitted)Next to a name
data-size="large"On a profile page
data-variant="square"Rounded square, for logos and organisations

When the name is already there, the picture is decoration. aria-hidden="true" stops the initials being read out as “J S” before the name.

The picture and the name are two elements side by side. How they are laid out is the app’s layout, not the component’s: a flex row with gap, a table cell, or whatever else the page uses.

When the picture stands alone, it has to say who it is:

<span class="lt-avatar">
<img src="/images/jane.jpg" alt="Jane Smith" />
</span>

The order is reversed in CSS: the first element in the markup sits furthest to the right in the stack. The names have to be somewhere, as in the text below: initials are not identification.

ClassWhat it is
.lt-avatarThe surface with the picture or the initials
ClassWhat it is
.lt-avatar-stackThe list of overlapping pictures
VariableDefault
--lt-avatar-sizevar(--lt-spacing-10)
--lt-avatar-radiusvar(--lt-spacing-1)
--lt-avatar-stack-overlapcalc(var(--lt-spacing-2) * -1)

--lt-avatar-size applies to the default size. data-size="small" and data-size="large" set their own.

--lt-avatar-radius applies only to the square variant. The round one is always round. See Customising.

  • Initials are not identification. Two people can have the same ones, so the name has to be somewhere.
  • An <img> without alt is read out as the file name. If the picture is decoration, write alt="".
  • Do not let the colour of the surface mean anything. It is arbitrary to anyone who cannot see it.