Create

Feedback

Spinner

Copy page View as Markdown Open in ChatGPT Open in Claude

An indicator that can be used to show a loading state.

Usage#

app.component.ts
import { WdsSpinnerComponent } from '@wds/angular/spinner';

Examples#

Default#

Size#

size sets 12, 16, 24 or 32px; --wds-spinner-size sets any size.

Color#

The spinner uses the text color (currentColor).

Button#

wds-button with loading shows its own spinner and sets aria-busy. A spinner placed in the content should be decorative, since the button text already says what is happening.

Saving Sending Loading

Badge#

Syncing Updating Processing

Input group#

With text#

Next to a text that describes the state, the spinner is decorative.

Loading data...

Empty#

Cancel

API References#

wds-spinner#

Loading indicator. It uses the text color (currentColor), so it fits text, buttons and badges. It has role="status" with a label; with decorative it is hidden from screen readers (e.g. when the parent already has aria-busy).

Attributes

AttributeTypeDefaultDescription
sizeWdsSpinnerSize'default'Size: sm 12px, default 16px, lg 24px, xl 32px.
labelstring'Ładowanie'Label for screen readers.
decorativebooleanfalseHides the spinner from screen readers (decoration only).

CSS parts (::part)

PartDescription
spinnerThe <svg> element.

CSS custom properties

PropertyDescription
--wds-spinner-sizeCustom size (overrides size).
--wds-spinner-durationDuration of one rotation (default 1s).

Accessibility#

Screen reader#

The spinner has role="status" and is named by label (default Ładowanie), so screen readers announce it when it appears. Set a label that says what is loading.

With decorative it is hidden from screen readers (aria-hidden="true"). Use it when a text next to the spinner or aria-busy on the parent already conveys the state.

With prefers-reduced-motion: reduce the rotation slows down three times instead of stopping, because the motion is what shows that loading goes on.

Keyboard support#

The spinner is not focusable and has no keyboard interaction.

Footer