<!--
  GENERATED FILE - do not edit by hand.
  Source of truth: src/components/mds-spinner/ in the magma monorepo (usage/*.md and the
  component's JSDoc). Regenerated on every stencil build (scripts/component-docs.ts).
-->

# mds-spinner

> `@maggioli-design-system/magma` 2.15.0. Shadow DOM: style it only through the public CSS custom properties and the parts below.

The `<mds-spinner>` web component is the Magma Design System's loading/await indicator: a self-contained, animated SVG spinner used standalone or embedded inside host components (`mds-button`, `mds-input`, `mds-entity`) to signal an in-progress, indeterminate operation. It has no HTML primitive equivalent and exposes no text content.

#### Semantic Behavior

- **Visibility is gated by `running`**: When `running` is absent/false the spinner is hidden and its animation is paused; setting `running` reveals it and starts the animation. The animation never runs while hidden, for performance.
- **No interactivity or accessibility role**: It is decorative - not focusable, emits no events, has no ARIA role, and is not form-associated. Any loading semantics (e.g. `aria-busy`) must be set by the surrounding context.
- **Reduced-motion and contrast aware**: The animation slows down (8s per turn, it never stops) when the Magma animation preference reduces motion (`pref-animation-reduce`, `mds-pref-animation`, or the OS `prefers-reduced-motion` under `system`), and the color is strengthened under the contrast preference, without consumer intervention.

#### Properties & Visual Configurations

The component exposes a single behavioral prop:

- **`running`** is the master switch that both shows the spinner and runs its animation; treat it as a boolean presence attribute and drive it from the consuming component's loading/await state rather than toggling visibility manually.

#### Other behavioral props

- **`--mds-spinner-duration`** (CSS custom property, default `0.725s`) tunes the rotation speed of the spin animation; override it on the host to slow down or speed up the indicator without touching markup.

## Read next

- [`examples.md`](examples.md) - correct usage, from the most common case
- [`mistakes.md`](mistakes.md) - the wrong forms, each with the right one
- [Storybook](https://magma-design-system.github.io/magma/storybook/?path=/docs/ui-spinner--docs) - the live examples, in the published Storybook of `main`
- [`conventions.md`](../../../../agents/conventions.md), [`variants.md`](../../../../agents/variants.md), [`mistakes.md`](../../../../agents/mistakes.md) - the rules shared by every component

## Props

| Prop | Attribute | Type | Default | Description |
| --- | --- | --- | --- | --- |
| `running` | `running` | `boolean \| undefined` | `false` | Specifies if the animation is running or not, it's required for performance reasons |

## CSS custom properties

| Property | Description |
| --- | --- |
| `--mds-spinner-duration` | Duration of the spinner animation. |

## Dependencies

Used by: `mds-button`, `mds-entity`, `mds-input`.
