Loader

The sign that the machine is working on something you asked for: three lit ticks stepping round a small ring. It is the display's busy comet, drawn for the web.

HTML
<div class="bm-stage" style="align-items:center">
  <div class="bm-rowx" style="gap:var(--space-5)"><span data-loader data-size="14"></span><span data-loader data-size="20"></span><span data-loader data-size="24"></span><span data-loader data-size="40"></span></div>
  <div class="bm-stack" style="width:300px">
    <button class="bm-btn bm-btn--primary bm-btn--block" aria-busy="true"><span data-loader data-size="18"></span>Saving</button>
    <button class="bm-cta" aria-busy="true"><span class="bm-cta__text"><span class="bm-cta__label">Starting</span><span class="bm-cta__sub">Waiting for the machine</span></span><span class="bm-cta__disc" data-loader data-size="24"></span></button>
  </div>
  <section class="bm-tile" style="width:320px">
    <div class="bm-notice" role="status"><span class="bm-notice__icon" data-loader data-size="20"></span><div class="bm-notice__body"><span class="bm-notice__title">Pairing the scale</span><span class="bm-notice__text">Keep it switched on and close by.</span></div></div>
    <span class="bm-field__msg"><span data-loader data-size="14"></span>Looking for networks nearby.</span>
  </section>
</div>
  • Use it while a command is on its way and has no measurable progress: starting a shot, saving to the machine, scanning for Wi-Fi, pairing a scale.
  • When progress can be measured, use a segment bar (SegmentBar, As progress).
  • Never for a page or a tile that is loading its first reading: tiles show — and unlit ticks, and there is no shimmer.
  • Always beside words that say what is happening. A Loader alone says nothing.

Anatomy

BetterMate.loader(size) returns an SVG of twelve ticks; data-loader with BetterMate.hydrate() does the same. Unlit ticks are track; three lit ticks take currentColor, so the Loader matches the text beside it. On a filled control (the ActionBanner, a primary or ink Button, a Toast) the unlit ticks are the label colour at 28%.

SizeWhere
14 pxIn a field's message line.
18 or 20 pxIn a Button, a Notice, a ListRow's end.
24 pxIn the ActionBanner's disc.
40 pxAlone in the middle of a Dialog, over a sentence.

Motion

The lit ticks advance one position every 80 ms, twelve steps to a turn, with steps(12): it steps, it does not sweep, the same as the ring on the display. Under prefers-reduced-motion it stands still, and the words beside it carry the meaning.

Timing

  • Show it at once when the wait follows a press; the control should answer within one frame.
  • If the wait passes 2 s for a machine command, or 15 s for a scan, stop, restore the control and say what happened in a Toast or Notice. A Loader never spins forever.

Screen reader

The SVG is aria-hidden. Put aria-busy="true" on the control or region that is working, and the words ("Saving", "Looking for networks nearby") in text or in the status region.