Spinner
A spinner shows that something is loading or in progress, when you don't know how long it will take.
A spinner shows that something is loading or in progress, when you don't know how long it will take: loading data, connecting to a device, running an action. Show it where the result will appear, so people know what they are waiting for.
Use a spinner for:
- Waiting for something without a known duration
- A whole page, panel, or card that is loading
Don't use a spinner for:
- An action started from a button. Use the
loadingstate of the button, or a progress button. The feedback then stays on the thing people selected. - A level against a known maximum. Use a bar.
- Loading that failed. Replace the spinner with an alert that says what went wrong.
- Track: the full circle behind the indicator
- Indicator: the arc that grows, shrinks, and turns around the track
There are four sizes. Pick the size that fits the space it is waiting to fill:
- Tiny: 16px
- Small: 28px
- Medium: 48px, the default
- Large: 68px
The spinner has one state: it keeps turning until you remove it. It has no hover, focus, or pressed state. The whole spinner turns once every 3.5 seconds, while the arc grows and shrinks every 1.5 seconds. The styles have no separate rule for reduced motion, so the animation runs the same when someone asks for less motion.
| Size | Diameter | Token |
|---|---|---|
| Tiny | 16px | --ha-spinner-size |
| Small | 28px | --ha-spinner-size |
| Medium, the default | 48px | --ha-spinner-size |
| Large | 68px | --ha-spinner-size |
| Property | Value | Token |
|---|---|---|
| Track and indicator width | 4px | None |
| Indicator color | Primary color | --primary-color, through --ha-spinner-indicator-color |
| Track color | Divider color | --divider-color, through --ha-spinner-divider-color |
| Indicator ends | Round | None |
| Rotation | 3.5s per turn, linear | None |
| Arc animation | 1.5s, ease-in-out | None |
- Don't leave a spinner running forever. If loading fails, replace it with an alert.
The spinner is not focusable, and has no keyboard interaction.
The spinner is announced as a progress bar named "Loading", without a value, because there is no known progress.
The spinner has the role progressbar, with the accessible name "Loading" from the localization of Web Awesome, and no value.
- Button: the
loadingstate for actions - Progress button: a button that shows the result of its action
- Bar: a level against a known maximum
- Alert: when loading fails
The element is <ha-spinner>. It is based on the Web Awesome spinner.
<ha-spinner></ha-spinner>
<ha-spinner size="small"></ha-spinner>size:tiny,small,medium, orlarge. Without it, the spinner is 48 pixels, the same asmedium.
--ha-spinner-size: the size, for when none of the presets fit. Thesizeattribute sets this for you.--ha-spinner-indicator-color: the moving part. Defaults tovar(--primary-color).--ha-spinner-divider-color: the track behind it. Defaults tovar(--divider-color).
Source: src/components/ha-spinner.ts