For AI agents: the complete documentation index is available at /llms.txt, the full documentation bundle is available at /llms-full.txt, and this page is available as Markdown at /dolan/spinner.md.

Spinner

Show that something is loading with a rotating icon, when you can't tell how long it will take.

Installation

npx @blotch/dolan add spinner
import { UiSpinner } from '../components/ui/spinner';

Usage

import { Component } from '@angular/core';
import { UiSpinner } from '../components/ui/spinner';

@Component({
  selector: 'app-loading',
  imports: [UiSpinner],
  template: `<ui-spinner color="var(--muted-foreground)" />`,
})
export class Loading {}
  • 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. color takes a theme token such as var(--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 same provideIconTheme() setting colors the spinner.
  • class takes Tailwind classes for the spinner, such as class="ml-2".

Sizes

<ui-spinner size="xs" />
<ui-spinner size="sm" />
<ui-spinner size="md" />
<ui-spinner size="lg" />

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

InputTypeDefaultDescription
size'xs' | 'sm' | 'md' | 'lg''md'Width and height: 16, 20, 24 or 32px.
colorstring | undefinedundefinedStroke color: a theme token such as var(--primary), or a literal color. The theme's foreground if unset.
classstring''Extra Tailwind classes for the spinner.

No outputs.

  • Button: shows a spinner while loading
  • Progress: show how far a task has got
  • Skeleton: hold the place of content that's loading