Skip to the content
Konstruktor UI

Feedback and overlays

Spinner and loading overlay

.kui-spinner says that work is going on and its length is unknown. .kui-loading with aria-busy="true" lays a spinner and a sentence over a region that is being loaded again.

CSS only

Examples

Sizes and with words

The spinner takes the current text colour. Put words next to it, or give it role="status" and an aria-label when it stands alone.

Učitavanje izvoda iz banke…

HTML
<span class="kui-spinner kui-spinner--sm" role="status" aria-label="Loading"></span>
<span class="kui-spinner" role="status" aria-label="Loading"></span>
<span class="kui-spinner kui-spinner--lg" role="status" aria-label="Loading"></span>
<p class="kui-cluster kui-gap-2 kui-text-muted" role="status"><span class="kui-spinner kui-spinner--sm" aria-hidden="true"></span><span>Učitavanje izvoda iz banke…</span></p>
<button class="kui-button kui-button--primary" type="button" aria-busy="true" aria-disabled="true"><svg class="kui-icon" aria-hidden="true"><use href="kit/icons.svg#save"></use></svg><span>Saving</span></button>

Loading overlay

The region keeps its content and dims it while aria-busy="true". The overlay holds a spinner and a sentence. Press the switch to turn it on and off.

Open invoices

Đorđević i sinovi d.o.o.
RSD 12,400.00
Müller Bauunternehmung GmbH
€3,150.00
Ćirić i partneri
RSD 88,900.00
Updating the amounts…
HTML
<div class="kui-stack">
  <div><button class="kui-button kui-button--sm" type="button" data-example-busy="spinner-region" aria-pressed="true">Loading</button></div>
  <div class="kui-card kui-loading" id="spinner-region" aria-busy="true">
    <h3 class="kui-card__title">Open invoices</h3>
    <dl class="kui-kv">
      <div><dt>Đorđević i sinovi d.o.o.</dt><dd>RSD 12,400.00</dd></div>
      <div><dt>Müller Bauunternehmung GmbH</dt><dd>€3,150.00</dd></div>
      <div><dt>Ćirić i partneri</dt><dd>RSD 88,900.00</dd></div>
    </dl>
    <div class="kui-loading__overlay" role="status"><span class="kui-spinner kui-spinner--lg" aria-hidden="true"></span><span>Updating the amounts…</span></div>
  </div>
</div>

States

Every state

Under reduced motion the spinner stops turning and shows a full ring at lower strength; the words beside it say that work goes on. A whole-page overlay is .kui-loading__overlay--page.

Default In faint text Syncing
HTML
<span class="kui-cluster kui-gap-2"><span class="kui-spinner" aria-hidden="true"></span><span>Default</span></span>
<span class="kui-cluster kui-gap-2 kui-text-faint"><span class="kui-spinner" aria-hidden="true"></span><span>In faint text</span></span>
<span class="kui-badge kui-badge--accent"><span class="kui-spinner kui-spinner--sm" aria-hidden="true"></span>Syncing</span>

Classes and attributes

.kui-spinner, --sm, --lg
The turning ring, in the current colour. --sm for inline use, --lg for an overlay.
.kui-loading
A region that can be busy. Its overlay shows only while it has aria-busy="true".
.kui-loading__overlay
The layer over the region with a spinner and a sentence. Give it role="status".
.kui-loading__overlay--page
The overlay fixed over the whole page, above everything.
aria-busy="true"
On the region while it loads. On a button it shows the button’s own spinner.

Accessibility

  • aria-busy="true" tells a screen reader that the region is changing; it reads it again when the attribute goes.
  • A spinner alone has role="status" and an aria-label; next to words, it is aria-hidden and the words are the status.
  • When loading takes longer than a few seconds, say what is happening and how long it may take.

Do and do not

Do

  • Use a skeleton for the first load of a page and a spinner for a short wait after an action.
  • Keep the old content visible under the overlay while it reloads.

Do not

  • Do not show a spinner for less than half a second; it only flickers.
  • Do not block the whole page when only one card is loading.