Spinner
loading state for actions.
vig-spinner
import { Spinner } from '@vigdx/ui/spinner';Sizes
size is sm (1em), md (1.5em, default) or lg (2em), all relative to the font size, so a spinner also grows with its surrounding text.
Variants
variant sets the ring color: primary (default), secondary for quiet placements, or one of the status hues.
In context
ariaLabel and hide the duplicate; as a panel placeholder, center it in the loading region. ariaLabel also translates the spinner's name.
Styling hooks
Internal elements carry a stable data-part and the component's data-scope; both are public API, so removing one is a breaking change. Select a part by both, e.g. [data-scope="spinner"][data-part="ring"] { … }: the pair stays within this component when kit components nest, and also reaches parts in overlay panels, which render outside the host. State is exposed through aria-* and, where listed, a data-state; literal values are checked by the API gate, values computed from the component's state follow its documented types. Other data-* attributes listed below (such as data-opening while an overlay animates) are API too. See Customizing.
Scope: [data-scope="spinner"]
| Part | Element | data-state |
|---|---|---|
ring | — |
Accessibility
- The spinner is an indeterminate
role="progressbar"named by itsariaLabel(default: thespinnerAriaLabellabel, “Loading”). It is not a live region, so it is read when users reach it rather than announced each time it appears. - Name what is loading, e.g. “Loading orders”. If the start of a long load matters, announce it yourself through a polite status message.
- Render the spinner only while loading. Removing it does not announce completion; show the result or a message instead.
- With
prefers-reduced-motionthe ring keeps turning, much slower (6s per turn): a still ring would read as stalled.
API
Spinner
vig-spinnerIndeterminate loading indicator, sized relative to the surrounding font.
Exposed as an indeterminate progressbar named by its label — a loading
indicator is not a live region, so it is not announced each time it
appears; announce completion separately if it matters. With reduced
motion the ring keeps turning, much slower, so it still reads as busy.
| Name | Type | Default | Description |
|---|---|---|---|
ariaLabel | string | undefined | undefined | Accessible name; defaults to the |
size | SpinnerSize | 'md' | — |
variant | SpinnerVariant | 'primary' | — |