Skip to the page content

Loaders

Spinners, skeletons and busy states while something loads.

Bootstrap docs

15 loader types

Border spinner

Bootstrap's .spinner-border in the palette. Text color utilities tint it, and the hidden label is what a screen reader hears.

Spinner
Loading…
Primary
Loading…
Success
Loading…
Info
Loading…
Warning
Loading…
Danger
Loading…
Muted
Show code
<div class="spinner-border" role="status">
  <span class="visually-hidden">Loading…</span>
</div>
<div class="spinner-border text-success" role="status">
  <span class="visually-hidden">Loading…</span>
</div>

Growing spinner

Bootstrap's .spinner-grow: a dot that swells and fades instead of turning. Quieter, for something that is still working in the background.

Spinner
Loading…
Primary
Loading…
Success
Loading…
Info
Loading…
Warning
Loading…
Danger
Loading…
Muted
Show code
<!-- The dot fades in and out, label and all, so the label sits beside it -->
<div class="d-inline-flex" role="status">
  <span class="spinner-grow text-info" aria-hidden="true"></span>
  <span class="visually-hidden">Loading…</span>
</div>

Spinner size

The small modifier, the default, and any size set with a style. Next to text, hide the spinner from screen readers and let the text be the status.

Spinner
Loading…
Loading…
Loading…
Loading…
Loading…
Loading…

Loading this week's orders…

Show code
<div class="spinner-border spinner-border-sm" role="status">…</div>
<div class="spinner-border ld-spinner-lg" role="status">…</div>

<!-- Beside text: the spinner is decoration, the text is the status -->
<span class="spinner-border spinner-border-sm" aria-hidden="true"></span>
<span role="status">Loading this week's orders…</span>

Search field loader

A small spinner at the end of a search box while results are on their way, and a count that says how many came back.

Spinner

8 products

    Show code
    <div class="basalt-search-loading is-loading">
      <i class="bi bi-search" aria-hidden="true"></i>
      <input type="search" class="form-control" aria-controls="results" aria-describedby="count">
      <span class="spinner-border" aria-hidden="true"></span>
    </div>
    <p id="count" aria-live="polite">Searching…</p>
    <ul id="results" aria-busy="true">…</ul>

    Staged loader

    For a job that takes a while. Each step waits, works under a spinner, then checks off with its time, and a screen reader hears each step as it starts.

    Spinner

    Monthly sales report

    Not started
    1. Collecting 1,284 invoices
    2. Adding up plan and add-on revenue
    3. Drawing the charts
    4. Saving the PDF

    Show code
    <ol class="basalt-stages" aria-label="Report steps">
      <!-- States: none (waiting), is-active (working), is-done -->
      <li class="basalt-stages-item is-done">
        <span class="basalt-stages-icon" aria-hidden="true">
          <span class="basalt-stages-wait"></span>
          <span class="spinner-border"></span>
          <i class="bi bi-check-circle-fill"></i>
        </span>
        <span>Collecting 1,284 invoices</span>
        <span class="basalt-stages-time">1.2 s</span>
      </li>
      <li class="basalt-stages-item is-active">…</li>
      <li class="basalt-stages-item">…</li>
    </ol>
    <p class="visually-hidden" aria-live="polite">Adding up plan and add-on revenue</p>

    Spinner in a button

    Bootstrap's own pattern: a disabled button holding a small spinner and a status label. While disabled it keeps a soft fill here, so the label stays readable.

    Button
    Show code
    <button class="btn btn-primary" type="button" disabled>
      <span class="spinner-border spinner-border-sm me-2" aria-hidden="true"></span>
      <span role="status">Placing order…</span>
    </button>

    Loading button

    The button that started the work shows it: a spinner while it runs, then a check, or a warning if it failed. It stays focusable throughout and keeps its width, so the row doesn't shift.

    Button

    Small and full width

    Show code
    <button type="button" class="btn btn-primary btn-loading btn-loading-swap">
      <span class="btn-loading-icon" aria-hidden="true"><i class="bi bi-floppy"></i></span>
      <span class="btn-loading-label">Save changes</span>
    </button>
    
    <script>
      // is-loading swaps the icon for a spinner and sets aria-disabled, so the
      // button keeps keyboard focus. Then is-done, or is-failed.
      basaltButtonState(btn, 'loading', 'Saving…');
      basaltButtonState(btn, 'done', 'Saved');
      basaltButtonState(btn, 'idle');
    </script>

    Refresh button

    An arrow that turns while the figure beside it reloads, as an icon button or with a label. The note under the figure says when it last changed.

    Button

    Orders today

    128

    Updated 2 minutes ago

    Clothing in stock

    456

    Updated 5 minutes ago

    Show code
    <button type="button" class="basalt-icon-btn basalt-refresh" aria-label="Refresh orders today">
      <i class="bi bi-arrow-clockwise" aria-hidden="true"></i>
    </button>
    
    <!-- Any Bootstrap button works too -->
    <button type="button" class="btn btn-sm btn-outline-secondary basalt-refresh">
      <i class="bi bi-arrow-clockwise me-1" aria-hidden="true"></i>Refresh
    </button>
    
    <script>
      btn.classList.add('is-spinning');
      btn.setAttribute('aria-busy', 'true');
    </script>

    Placeholder

    Bootstrap's .placeholder blocks, sized with grid columns and animated by .placeholder-glow or .placeholder-wave on the parent.

    Skeleton
    Show code
    <div class="card" aria-hidden="true">
      <div class="card-body">
        <h5 class="card-title placeholder-glow"><span class="placeholder col-6"></span></h5>
        <p class="card-text placeholder-glow">
          <span class="placeholder col-7"></span>
          <span class="placeholder col-4"></span>
        </p>
        <a class="btn btn-primary disabled placeholder col-6" aria-disabled="true"></a>
      </div>
    </div>
    <!-- placeholder-wave in place of placeholder-glow for a sweeping shine -->

    Skeleton table

    A bar in every cell, about as wide as the value it waits for, under the real column headers. The rows arrive one at a time.

    Skeleton

    Loading orders…

    Latest orders
    Order Customer Items Total Status
    #4821 Annabelle Franklin 3 $737.00 Paid
    #4820 Sabrina Kavanagh 1 $395.00 Waiting
    #4819 Iva Blackwood 5 $295.00 Paid
    #4818 Christopher Vance 2 $238.00 Packed
    #4817 Travis Daugherty 4 $596.00 Refunded
    Show code
    <table class="table basalt-loadable is-loading" aria-busy="true">
      <thead>…</thead>
      <!-- One skeleton bar per cell, roughly as wide as the real value -->
      <tbody class="basalt-loadable-ghost" aria-hidden="true">
        <tr>
          <td><span class="basalt-skeleton basalt-skeleton-text w-25"></span></td>
          <td><span class="basalt-skeleton basalt-skeleton-text w-75"></span></td>
        </tr>
      </tbody>
      <tbody class="basalt-loadable-real">
        <tr class="stagger-0"><td>#4821</td><td>Annabelle Franklin</td></tr>
      </tbody>
    </table>

    Skeleton loader

    Gray shapes the size of the content they stand in for, so nothing jumps when it arrives. The real cards rise in one after another; pick shimmer, pulse or still for the waiting shapes.

    Skeleton

    Loading products…

    Sculpted Shoulder Blazer

    Grain de poudre wool, built in Illinois, sharp enough to wear all winter long.

    $1,290

    Draped Column Gown

    Cobalt silk jersey, draped by hand, cut long enough to sweep in.

    $2,150

    Tiered Organza Dress

    Hand-pleated organza tiers over a corset bodice. Made to order, in four weeks.

    $1,680
    Show code
    <div class="basalt-loadable is-loading" aria-busy="true">
      <!-- Shown while loading. Motion: add basalt-skeleton-pulse or --still -->
      <div class="basalt-loadable-ghost" aria-hidden="true">
        <span class="basalt-skeleton basalt-skeleton-block"></span>
        <span class="basalt-skeleton basalt-skeleton-title"></span>
        <span class="basalt-skeleton basalt-skeleton-text"></span>
        <span class="basalt-skeleton basalt-skeleton-text w-70"></span>
      </div>
      <!-- Shown once is-loading comes off; children rise in by --i -->
      <div class="basalt-loadable-real">
        <article class="stagger-0">…</article>
        <article class="stagger-1">…</article>
      </div>
    </div>
    
    <script>
      box.classList.remove('is-loading');
      box.setAttribute('aria-busy', 'false');
    </script>

    Dots loader

    Three dots for a short wait, on their own or after a line of text. They bounce by default or fade with the pulse modifier.

    Dots
    Loading
    Bounce
    Loading
    Pulse
    Loading
    Large, success
    Loading
    Small, muted

    Checking stock in three warehouses

    Show code
    <span class="basalt-loading-dots" role="status">
      <span></span><span></span><span></span>
      <span class="visually-hidden">Loading</span>
    </span>
    <!-- basalt-loading-dots-pulse fades instead of bouncing.
         Size: --sm, --lg. Tone: --muted, --success, or any text color. -->

    Typing indicator

    Three dots in a chat bubble while the other person writes. The bubble is a status, so screen readers say who is typing.

    Dots

    YouIs the Sculpted Shoulder Blazer still in stock?

    Elsie is typing
    Show code
    <span class="basalt-typing" role="status">
      <span class="basalt-loading-dots" aria-hidden="true"><span></span><span></span><span></span></span>
      <span class="visually-hidden">Elsie is typing</span>
    </span>

    Page loading bar

    A thin bar along the top edge that creeps forward while a page loads and fills when it lands. Pin it to the window, or run it along the top of any panel.

    Bar

    Ready

    Show code
    <!-- Top of the window: add basalt-loadbar-fixed. Inside a panel: give the
         panel position: relative and leave the modifier off. -->
    <div class="basalt-loadbar basalt-loadbar-fixed" aria-hidden="true"></div>
    
    <script>
      bar.classList.add('is-active');                 // show it
      bar.style.setProperty('--loadbar-value', 60);   // move it along
      bar.classList.add('is-done');                   // fill and fade
      bar.style.setProperty('--loadbar-value', 100);
    </script>

    Panel overlay

    A veil with a spinner over one panel while it refreshes. The panel underneath keeps its size and can't be clicked, and focus moves to Cancel so the keyboard isn't stranded.

    Overlay

    Stock by warehouse

    Counted 20 minutes ago

    • Elko, Nevada212 units
    • Columbus, Ohio148 units
    • Ann Arbor, Michigan96 units

    Counting stock…

    Show code
    <div class="card basalt-loading-host is-busy" aria-busy="true">
      <div class="card-body" inert>…the panel's content…</div>
      <div class="basalt-loading-overlay" role="status" aria-live="polite">
        <span class="spinner-border" aria-hidden="true"></span>
        <p class="basalt-loading-overlay-text">Counting stock…</p>
        <button type="button" class="btn btn-sm btn-outline-secondary">Cancel</button>
      </div>
    </div>