Spinner
Shows that something is loading. It takes the text color, so it fits on any background. For a whole box that is busy, lay one over it.
Spinner
Loading…
Loading…
Loading…
Loading…
Loading…
Saving…
<span class="spinner spinner-sm" role="status"><span class="visually-hidden">Loading…</span></span>
<span class="spinner" role="status"><span class="visually-hidden">Loading…</span></span>
<span class="spinner spinner-lg" role="status"><span class="visually-hidden">Loading…</span></span>
<span class="spinner text-violet" role="status"><span class="visually-hidden">Loading…</span></span>
<span class="spinner-dots" role="status"><span class="visually-hidden">Loading…</span></span>
<span class="hstack gap-2 text-muted"><span class="spinner spinner-sm" aria-hidden="true"></span> Saving…</span>A busy box
Put a .spinner-overlay inside a box with position: relative (a card already has it) and set aria-busy="true" on the box while it loads.
Monthly report
Visits, sign-ups and sales for November.
<div class="card max-w-sm" aria-busy="true" style="position: relative">
<div class="card-body">
<h3 class="card-title">Monthly report</h3>
<p class="card-text text-muted">Visits, sign-ups and sales for November.</p>
<button class="btn btn-sm" type="button">Download</button>
</div>
<div class="spinner-overlay" role="status"><span class="spinner"></span>Loading the report…</div>
</div>For a button, use .btn.is-loading (see Button); for content still on its way, a skeleton shows its shape.
Classes
| Class | Does |
|---|---|
.spinner | A turning ring, 24px (--spinner-size, --spinner-width) |
.spinner-sm / -lg | 16px / 40px |
.spinner-dots | Three dots appearing one by one |
.spinner-overlay | Covers its box with a faded layer and centers what is inside |
Accessibility
- Give a spinner
role="status"and hidden words ("Loading…"), or put real words next to it and hide the spinner witharia-hidden="true". - With reduced motion turned on it keeps turning, but slowly: it still has to show that something is happening.