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
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.
<zb:spinner size="md" type="border" />
<zb:spinner size="md" type="grow" />
<zb:spinner size="sm" type="border" />
<zb:spinner size="sm" type="grow" />
<zb:spinner size="lg" type="border" />
<zb:spinner size="lg" type="grow" />
| Prop | Values |
|---|---|
size | sm | md | lg |
type | border | grow |
Colors
BLADE
The indicator uses the text color (the brand color by default); for another color, give a text-* class.
<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>
| Prop | Values |
|---|---|
class | text-* color class |
Screen reader text
BLADE
label tells screen readers what is loading; the default is "Loading".
<zb:spinner label="Loading the customer list" />
| Prop | Values |
|---|---|
label | Screen reader text |
Props
The values the component takes. What are props and slots?
| Prop | Type | Default | Description |
|---|---|---|---|
size | — | md | sm · md · lg |
type | — | border | border · grow |
label | — | Loading | Screen reader text |
color | — | primary | primary · secondary · success · danger · warning · info · dark · current (the text colour around it: a button's) |
decorative | boolean | false | true: 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
- With reduced motion on, the ring spins slowly and the dot stays still.
- The indicator has
role="status";labelis read as visually hidden text.