Spinner
>
Since v1.0.0
Importing
Add rh-spinner to your page with this import statement:
<script type="module">
import '@rhds/elements/rh-spinner/rh-spinner.js';
</script>
Copy to Clipboard
Copied!
Wrap lines
Overflow lines
To learn more about installing RHDS elements on your site using an import map read our getting started docs.
Usage
<rh-spinner></rh-spinner>
<script type="module">
import '@rhds/elements/rh-spinner/rh-spinner.js';
</script>
Copy to Clipboard
Copied!
Wrap lines
Overflow lines
Usage
Default/Large Spinner
<rh-spinner></rh-spinner>
Medium Spinner
<rh-spinner size="md"></rh-spinner>
Small Spinner
<rh-spinner size="sm"></rh-spinner>
rh-spinner
Provides an animated loading indicator for when content is being
processed or fetched. A spinner should be used when loading takes
fewer than ten seconds and the content structure is unknown.
Authors must not use a spinner for indeterminate loading over ten
seconds; use a progress bar instead. Authors should avoid omitting
a text label, as screen readers rely on role="status" to announce
the ARIA live region. The element is not keyboard-focusable.
Theming
This element uses Red Hat design system theming and can be used in themable contexts.
Slots
1
| Slot Name | Summary | Description |
|---|---|---|
[default]
|
Optional text label displayed below the animated circle.
Use a |
Attributes
1
| Attribute | DOM Property | Description | Type | Default |
|---|---|---|---|---|
size
|
size |
Preset sizes for the spinner |
|
|
Methods
0
None
Events
0
None
CSS Shadow Parts
0
None
CSS Custom Properties
12
| CSS Property | Description | Default |
|---|---|---|
--rh-spinner-container-animation-name |
Container animation name for the SVG element |
none
|
--rh-spinner-container-animation-duration |
Container animation duration for the SVG element |
0s
|
--rh-spinner-container-animation-timing |
Container animation timing function for the SVG element |
linear
|
--rh-spinner-vector-effect |
SVG vector-effect for stroke scaling behavior |
non-scaling-stroke
|
--rh-spinner-animation-duration |
Dash circle animation duration |
1.4s
|
--rh-spinner-animation-timing |
Dash circle animation timing function |
ease-out
|
--rh-spinner-rotate-start |
Dash circle initial rotation |
-90deg
|
--rh-spinner-track-display |
Track circle display property |
revert
|
--rh-spinner-animation-name |
Dash circle animation name Small dash circle animation name |
rh-spinner-small-animation-dash
|
--rh-spinner-dash-array |
Dash circle stroke-dasharray value Small dash circle stroke-dasharray value |
71
|
--rh-spinner-dash-offset |
Dash circle stroke-dashoffset value Small dash circle stroke-dashoffset value |
71
|
--rh-spinner-stroke-width |
Stroke width of the spinner circle, in unitless SVG user units Default spinner circle stroke width Large spinner circle stroke width Medium spinner circle stroke width Small spinner circle stroke width |
3
|
Design Tokens
14
| Token | Description | Copy |
|---|---|---|
--rh-space-lg
|
Margin between spinner circle and text label 16px spacer |
|
--rh-font-family-body-text
|
Text label font family Body text font family |
|
--rh-font-weight-body-text-regular
|
Text label font weight Regular font weight |
|
--rh-line-height-body-text
|
Text label line height Line height for body text |
|
--rh-length-4xl
|
Default spinner circle diameter 64px length token |
|
--rh-color-accent-base
|
Animated indicator stroke color |
|
--rh-color-gray-10
|
Track stroke color in light mode Tertiary surface (light scheme) |
|
--rh-color-gray-70
|
Track stroke color in dark mode Tertiary surface (dark scheme) |
|
--rh-size-icon-06
|
Large spinner circle diameter 64px icon box |
|
--rh-font-size-body-text-lg
|
Large spinner text label font size 18px font size |
|
--rh-size-icon-04
|
Medium spinner circle diameter 40px icon box |
|
--rh-font-size-body-text-md
|
Medium spinner text label font size 16px font size |
|
--rh-size-icon-01
|
Small spinner circle diameter 16px icon box |
|
--rh-font-size-body-text-sm
|
Small spinner text label font size 14px font size |
|
Other libraries
To learn more about our other libraries, visit this page.
Feedback
To give feedback about anything on this page, contact us.