v0.0.2
Demos (demo panel, opens in a new tab)

Spinner

Shows a loading state while something runs; on buttons use the loading prop of zb:button, and to lock an area use zb:loading-overlay.

zb:spinner zubazar/ui · free (MIT)

Size and type

Size and type: view
BLADE

size picks the diameter (sm next to text, lg in the middle of an empty area); border is a spinning ring, grow a dot that grows and fades.

size
type
blade
<zb:spinner size="md" type="border" />
blade
<zb:spinner size="md" type="grow" />
blade
<zb:spinner size="sm" type="border" />
blade
<zb:spinner size="sm" type="grow" />
blade
<zb:spinner size="lg" type="border" />
blade
<zb:spinner size="lg" type="grow" />
PropValues
sizesm | md | lg
typeborder | grow

Colors

Colors: view
BLADE

The indicator uses the text color (the brand color by default); for another color, give a text-* class.

blade
<div class="flex flex-wrap items-center gap-6">
    <zb:spinner class="text-success-line" />
    <zb:spinner class="text-warning-line" />
    <zb:spinner class="text-danger-line" type="grow" />
    <zb:spinner class="text-muted" type="grow" />
</div>
PropValues
classtext-* color class

Screen reader text

Screen reader text: view
BLADE

label tells screen readers what is loading; the default is "Loading".

blade
<zb:spinner label="Loading the customer list" />
PropValues
labelScreen reader text

Props

The values the component takes. What are props and slots?

PropTypeDefaultDescription
size—mdsm · md · lg
type—borderborder · grow
label—LoadingScreen reader text
color—primaryprimary · secondary · success · danger · warning · info · dark · current (the text colour around it: a button's)
decorativebooleanfalsetrue: only a picture (aria-hidden; no role and no "Loading" text). Use it inside a button that says what is going on itself: <zb:button><zb:spinner decorative color="current" size="sm" /> Adding…</zb:button>

Developer notes

Events, hooks and details
  • With reduced motion on, the ring spins slowly and the dot stays still.
  • The indicator has role="status"; label is read as visually hidden text.
Zubazar UI · ZubazarDesigned for people.