Skip to content

Skeleton

Grey shapes that show where the content will appear. They are always hidden from screen readers, so the wait has to be announced somewhere as well. If there is no shape to show, or the wait is short, Spinner is simpler.

data-variantUsed for
(omitted)A block, for images and cards
textOne line of text
circleA profile picture

The block and the text lines fill the width they are given, while circle is as wide as it is high. case-last-line and case-image are your own classes, not LO-TEK’s, and they are in the “Plain HTML” tab above together with the markup.

Set the width of the last line to less than 100 per cent. A paragraph where every line is the same length does not look like text.

<div id="content" aria-busy="true">
<p class="lt-sr-only" role="status">Fetching your applications</p>
<div class="lt-skeleton" data-variant="text" aria-hidden="true"></div>
<div class="lt-skeleton" data-variant="text" aria-hidden="true"></div>
</div>

A row of empty boxes being read out is worse than silence. That is why lt.skeleton() always sets aria-hidden="true", and the message goes in a separate element with role="status".

When the content arrives, remove aria-busy and empty the status element.

ClassWhat it is
.lt-skeletonThe placeholder. The shape comes from data-variant.
VariableDefault
--lt-skeleton-heightvar(--lt-spacing-4), and var(--lt-spacing-10) in circle, where it also gives the width. text does not read it: there the height comes from --lt-font-size-m
--lt-skeleton-radiusvar(--lt-spacing-1), and var(--lt-spacing-0-5) in text

The shimmer is a gradient moving across the surface, not a pulsing transparency, so the contrast against the page surface is the same throughout. If the user has asked for reduced motion, the surface stays still.

See Customising for how the variables and the layer work.

  • The shapes should resemble what is coming. A placeholder of three lines where the result is twenty makes the page jumpy when the content lands.
  • Wait a little before showing them, as with a loading indicator. A flash of grey boxes is more disruptive than a short pause.
  • Do not leave them in place if something fails. The user is then waiting for something that never comes. Replace them with an Alert saying what went wrong.