Skip to content
Statix Design System

Display

Spinner

Rotating icon for a short wait after the customer did something, such as checking a website or restoring a backup.

import { Spinner } from '@statix/ui/spinner';

Examples

Basic

It takes the text colour. Size it with size-* classes.

<script lang="ts">
	import { Spinner } from '@statix/ui/spinner';
</script>

<Spinner />
<Spinner class="size-6" />
<Spinner class="size-8 text-primary" />

In a button

Replace the leading icon while the action runs and disable the button.

<script lang="ts">
	import { Button } from '@statix/ui/button';
	import { Spinner } from '@statix/ui/spinner';
</script>

<Button disabled>
	<Spinner data-icon="inline-start" aria-hidden="true" class="size-[1.15em]" />
	Restoring website
</Button>
<Button variant="outline" size="sm" disabled>
	<Spinner data-icon="inline-start" aria-hidden="true" class="size-[1.15em]" />
	Saving
</Button>

Inline status

Next to a line of text that says what is happening.

Checking yoga-berger.de. This takes a few seconds.

<script lang="ts">
	import { Spinner } from '@statix/ui/spinner';
</script>

<p class="flex items-center gap-2 text-ink-2" role="status">
	<Spinner aria-hidden="true" />
	Checking yoga-berger.de. This takes a few seconds.
</p>

Guidelines

Do

  • Say what is happening next to the spinner: "Checking yoga-berger.de".
  • Use a Progress bar instead when you know how far along the task is.

Don't

  • Don’t show several spinners at once. Use skeletons for loading page content.

Accessibility

  • Renders an <svg role="status" aria-label="Loading">. Pass a more specific aria-label when there is no visible text.
  • When visible text already says what is loading, pass aria-hidden="true" so the status is not read twice.
  • The rotation stops when the user prefers reduced motion.

API reference

Spinner

renders <svg> and accepts its attributes
PropTypeDefault
aria-label string

Accessible name of the status.

'Loading'
role string

ARIA role.

'status'
class ClassValue

Size and colour. Default size-4 in currentColor.

–
Data attributeMeaning
data-slot="spinner"Always present.