Skip to the content
Konstruktor UI

Surfaces and display

Skeleton

Grey shapes where content will appear, while it loads. .kui-skeleton as text lines, a title, a circle or a block. It keeps the layout from jumping when the content arrives.

CSS only

Examples

A list item and a card loading

The shapes are aria-hidden; the container has aria-busy="true" and hidden words say what is loading.

Loading the case
Loading messages
HTML
<div class="kui-grid">
  <div class="kui-card" aria-busy="true">
    <span class="kui-visually-hidden">Loading the case</span>
    <span class="kui-skeleton kui-skeleton--title" aria-hidden="true"></span>
    <div aria-hidden="true">
      <span class="kui-skeleton kui-skeleton--text"></span>
      <span class="kui-skeleton kui-skeleton--text"></span>
      <span class="kui-skeleton kui-skeleton--text" style="width: 60%"></span>
    </div>
  </div>
  <div class="kui-card" aria-busy="true">
    <span class="kui-visually-hidden">Loading messages</span>
    <div class="kui-cluster kui-cluster--nowrap" aria-hidden="true">
      <span class="kui-skeleton kui-skeleton--circle"></span>
      <div style="flex: 1"><span class="kui-skeleton kui-skeleton--text" style="width: 40%"></span><span class="kui-skeleton kui-skeleton--text"></span></div>
    </div>
    <span class="kui-skeleton kui-skeleton--block" aria-hidden="true"></span>
  </div>
</div>

States

Every state

The shimmer moves slowly from right to left; with reduced motion asked for, the kit’s motion tokens stop it and the shapes stay still. Match the shapes to the content that will come: as many lines, the same widths.

Loading
HTML
<div class="kui-stack" aria-busy="true">
  <span class="kui-visually-hidden">Loading</span>
  <span class="kui-skeleton kui-skeleton--title" aria-hidden="true"></span>
  <span class="kui-skeleton kui-skeleton--text" aria-hidden="true"></span>
  <span class="kui-skeleton kui-skeleton--text" style="width: 80%" aria-hidden="true"></span>
</div>

Classes and attributes

.kui-skeleton
A shape as tall as a line of text.
--text, --title, --circle, --block
A text line, a title (half width), an avatar, an image or chart.
aria-busy="true"
On the container while it loads; remove it when the content is in.

Accessibility

  • Hide the shapes from screen readers; say “Loading the case” once in hidden words.
  • Set aria-busy on the region and clear it when the content arrives.
  • If loading takes longer than a few seconds, show words that say so.

Do and do not

Do

  • Use skeletons for content that takes under a few seconds.
  • Keep the shapes the size of the real content.
  • Replace the whole skeleton at once.

Do not

  • Do not show skeletons for an error; show the error.
  • Do not use a skeleton and a spinner together.
  • Do not animate them fast.