> For AI agents: the complete documentation index is available at /llms.txt, the full documentation bundle is available at /llms-full.txt.

# Spinner

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


## Installation

```bash
npx @blotch/dolan add spinner
```

```typescript
import { UiSpinner } from '../components/ui/spinner';
```

## Usage

```typescript
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](/guide/animations/index.md#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](/guide/glossary.md#lynx)'s [`<svg>`](/api/elements/svg.md) element, which can't read your CSS, so theme tokens are looked up the way [Icon](/dolan/icon.md#colors) does it. For dark mode, see [Icon](/dolan/icon.md#dark-mode): the same `provideIconTheme()` setting colors the spinner.
- `class` takes Tailwind classes for the spinner, such as `class="ml-2"`.

### Sizes

```angular-html
<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](/dolan/button.md) 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

| Input   | Type                           | Default     | Description                                                                                                |
| ------- | ------------------------------ | ----------- | ---------------------------------------------------------------------------------------------------------- |
| `size`  | `'xs' \| 'sm' \| 'md' \| 'lg'` | `'md'`      | Width and height: 16, 20, 24 or 32px.                                                                      |
| `color` | `string \| undefined`          | `undefined` | Stroke color: a theme token such as `var(--primary)`, or a literal color. The theme's foreground if unset. |
| `class` | `string`                       | `''`        | Extra Tailwind classes for the spinner.                                                                    |

No outputs.

## Related

- [Button](/dolan/button.md): shows a spinner while `loading`
- [Progress](/dolan/progress.md): show how far a task has got
- [Skeleton](/dolan/skeleton.md): hold the place of content that's loading
