Spinner
Alignment target:@astryxdesign/core v0.7.1 · Spinner
Usage #
Spinner shows a loading state when the duration of a process is unknown.
Vue
<script setup lang="ts">
import { Spinner } from '@astryx-vue/core/Spinner'
</script>
<template>
<Spinner label="Loading data" />
</template>Best practices #
| Guidance | Practices |
|---|---|
| Do | Provide a meaningful label to describe what is loading for screen reader users. |
| Do | Use the "onMedia" shade when placed on dark or accent-colored backgrounds. |
| Don't | Use for content areas with known dimensions; use Skeleton to preserve layout instead. |
| Don't | Stack multiple spinners in the same view; use one to represent the overall loading state. |
Examples #
Spinner — On media
default sits on a light surface. onMedia sits on a dark surface.
Spinner — Sizes
sm, md, lg, and xl.
Spinner — With label
Loading...
Fetching data This may take a moment
A short label, or a title and a supporting line. The accessible name stays Fetching data when the label is rich.
Accessibility #
A Spinner has no visible text of its own, so its loading state reaches assistive technology entirely through ARIA attributes. The component sets these for you, and you normally do not need to manage them yourself; the list below covers the attributes it actually uses and what each one does.
- The root element carries
role="status", so assistive technology treats it as a status region. - When you pass a string
label, it shows as visible text below the spinner and provides the accessible name througharia-labelledby. - Without a
label, the accessible name defaults toLoading; passaria-labelto change it to something more specific to the context. - The ring is
aria-hiddenand carries no text of its own, so it is not read out separately. - With reduced motion enabled, the arc slows to a 3-second cycle.