--- title: Spinner summary: A spinner is used to show the loading state of a component or page. It provides feedback for an action that takes longer to complete. description: Show loading states with spinners. Choose between border and growing styles, change colors and sizes, or place them in buttons. related: [/ui/components/progress, /ui/components/placeholder] source: core/scss/ui/_loaders.scss css-vars: spinner classnames: component: - class: spinner-border desc: Rotating ring - class: spinner-grow desc: Pulsing dot, a quieter alternative color: - class: text-{color} desc: Any base color, for example text-primary size: - class: spinner-border-sm desc: Small ring - class: spinner-grow-sm desc: Small dot --- import Example from '@components/Example.astro'; ## Default markup The default spinner shows that an action is in progress.
## Colors Set the color with a `text-*` class from the [color palette](/ui/base/colors).
## Size Add `spinner-border-sm` for a smaller spinner.
## Growing spinner The growing spinner pulses instead of rotating.
It takes the same `text-*` color classes.
## Button with spinner Put a spinner inside a [button](/ui/components/button) while its action runs, and disable the button so it can't be clicked twice.
Button Button Button Button Button
## Animated dots Animated dots are a lighter loading indicator for inline text. Add the `.animated-dots` class to a `span`.

Loading

Animated dots also fit inside a button while its action runs.
Loading Loading
## Accessibility - A spinner on its own says nothing. Add `role="status"` and a `visually-hidden` label such as "Loading", so the wait is announced. - Put the spinner where the content will appear, and set `aria-busy="true"` on that container while it loads. - Do not use a spinner for something that takes under a second. It flashes, which is more distracting than no feedback at all. - For a wait with a known length use a [progress bar](/ui/components/progress) instead - it tells users how much is left.