Use Spinner...
- To provide feedback for user interaction.
- When loading time is expected to take between 1 and 10 seconds.
Don't use Spinner...
- To show loading progress or time remaining. Use Progress Bar instead.
- When loading time is expected to take longer than 10 seconds. Use Progress Bar instead.
- To indicate an image is loading. Use the Loading Shimmer background color instead.
The preview has been updated.
Size
Standard
Use size="standard"
for most use cases.
The preview has been updated.
Super
Use size="super"
for larger elements, such as a full page load.
The preview has been updated.
Mini
skin="mini"
is deprecated in SWAN v3.3
Use the skin="standard"
instead, which aligns with new semantic roles on SWAN components.
Use size="mini"
for smaller individual UI elements, such as an Alert Box.
The preview has been updated.
Tiny
skin="tiny"
is deprecated in SWAN v3.3
Use the skin="standard"
instead, which aligns with new semantic roles on SWAN components.
Use size="tiny"
for smaller individual UI elements, such as a Button (refer to Inside a Button below).
The preview has been updated.
Text label
All Spinners must have accessible text, which is ordinarily hidden on screens. Use accessibleText
to describe the function of the Spinner. Use showText
to make that text visible for everyone.
Use showText
if loading time is expected to take longer than 2 seconds.
The preview has been updated.
Layout
Visible text is displayed below the Spinner. Use layout="horizontal"
to display visible text to the right of the Spinner.
The preview has been updated.
Overlay
Use overlay="true"
to show a white box behind the Spinner, which can help make it more visible when displaying over other content (eg. to indicate that the full page is loading).
The preview has been updated.
With Button
To indicate a loading state for actions in progress, follow the loading instructions for Button.
Accessibility
Spinners need ARIA attributes for a11y support. The component does not provide these automatically, since the right attributes can depend on context.
- Spinners need a
role
attribute. Typically this will berole="alert"
when the Spinner functions as a form of alert. However, this might also be a value ofstatus
if the Spinner contains status information. - Spinners should have an
aria-live
attribute. Typically this should bearia-live="polite"
. If the Spinner is particularly critical and should be announced immediately (e.g. a full-page overlay with a Spinner on it), consideraria-live="assertive"
instead. - If a page container is getting new content while the Spinner is shown, remember to put
aria-busy="true"
on that container while the loading is happening, and set it tofalse
when done.