Spinner
Show that something is loading with a rotating icon, when you can't tell how long it will take.
Installation
Usage
- The spinner turns once every 1.6 seconds, for as long as it's on screen. It keeps turning while your app is busy, building a screen say: the platform turns it, Core Animation on iOS and Android's animators (see Keep a transition moving while your app works).
- Without
color, it draws in your theme's foreground.colortakes a theme token such asvar(--primary)or a literal color such as#3b82f6. - It's drawn with Lynx's
<svg>element, which can't read your CSS, so theme tokens are looked up the way Icon does it. For dark mode, see Icon: the sameprovideIconTheme()setting colors the spinner. classtakes Tailwind classes for the spinner, such asclass="ml-2".
Sizes
xs is 16px, sm 20px, md 24px and lg 32px.
In a button
Button shows a spinner before its label while loading is true, in the label's color. Use that rather than putting a <ui-spinner> inside the button: the button puts what you write inside it in its label's <text>, which is meant for text.
API
UiSpinner
No outputs.
