Feedback
Loading
An animated spinner in the current text color, for a wait the user should see: a request running, content being loaded. Buttons, inputs and loadable content show it on their own; use the tag directly anywhere else.
Nothing to show
A 24px spinning arc in the color of the surrounding text, announced to screen readers as "Loading..." (translated).
Variants #
Three bouncing dots, three pulsing bars in a larger size, and an expanding blue ring. The other variants are infinity and ball.
Nothing to show
While Livewire works #
The spinner shows next to the button only while sync runs, and is announced as "Syncing".
Nothing to show
All variants #
variant picks the animation: the default arc, dots, bar, ring, ball or infinity.
Nothing to show
Sizes #
size sets the width and height, from xs to 3xl.
Nothing to show
Colors #
The spinner is drawn with the text color, so a text color class on the tag, or on a parent, changes it.
Nothing to show
Next to text #
When the text already says what is happening, :announce="false" makes the spinner a plain image instead of a live region.
Nothing to show
Customization #
Classes go to the <span>: a size class changes its size and a text color class its color.
Nothing to show
Reference
tk:loading
| Prop | Type | Default | Description |
|---|---|---|---|
variant |
string | spinner | The animation: dots, bar, ring, ball, infinity, or the default spinning arc. |
size |
string | md |
xs, sm, md, lg, xl, 2xl or 3xl. Sets the width and height. |
label |
string | Loading... |
The accessible name, translated. |
announce |
bool | true |
Makes the spinner a polite live region (role="status"), so its appearance is announced. false makes it a plain image (role="img"), for spinners next to text that already says what is happening. |
Customization
Classes and attributes go to the <span>. The spinner is drawn with the text color, so a text color class changes its color; a size class changes its size.
Nothing to show
Accessibility
The spinner has an aria-label. By default it is a polite live region, so screen readers announce it when it appears; with :announce="false" it is an image that is read only when reached.
Behavior notes
- The animations are SVG masks over the text color: they need no JavaScript and follow dark mode with the text.