Spinners
Source: https://getbootstrap.com/docs/6.0/components/spinner
Indicate the loading state of a component or page with Bootstrap spinners, built entirely with HTML, CSS, and no JavaScript.
Bootstrap “spinners” can be used to show the loading state in your projects. They’re built only with HTML and CSS, meaning you don’t need any JavaScript to create them. You may, however, need some custom JavaScript to toggle their visibility. Their appearance, alignment, and sizing can be easily customized with our utility classes.
For accessibility purposes, each loader here includes role="status" and a nested <span class="visually-hidden">Loading…</span>.
Border spinner
Use the border spinners for a lightweight loading indicator.
<span class="visually-hidden">Loading…</span>
</div>
<span class="badge theme-primary"> <span class="spinner-border" aria-hidden="true"></span> <span role="status">Loading</span> </span>
<button class="btn-subtle theme-primary" type="button" disabled> <span class="spinner-border" aria-hidden="true"></span> <span role="status">Loading…</span> </button>`} />
Growing spinner
If you don’t fancy a border spinner, switch to the grow spinner. While it doesn’t technically spin, it does repeatedly grow!
<span class="visually-hidden">Loading…</span>
</div>`} />
Variants
Spinners use currentColor for their appearance, meaning you can customize the color with text color utilities. You can use any of our text color utilities on the standard spinner.
<Example class="d-flex align-items-center gap-3" code={`<div class="spinner-border fg-primary" role="status"><!--[!code highlight]--> <span class="visually-hidden">Loading…</span> </div>
<div class="spinner-grow fg-accent" role="status"><!--[!code highlight]--> <span class="visually-hidden">Loading…</span> </div>`} />
Size
Spinner are 1em by 1em by default, all Add .spinner-sm to make a smaller spinner that can quickly be used within other components.
<span class="visually-hidden">Loading…</span>
</div> <div class="spinner-grow spinner-sm" role="status"> <span class="visually-hidden">Loading…</span> </div>`} />
Or, use custom CSS or inline styles to change the dimensions as needed.
<span class="visually-hidden">Loading…</span>
</div> <div class="spinner-grow" style="width: 3rem; height: 3rem;" role="status"> <span class="visually-hidden">Loading…</span> </div>`} />
Custom spinners
You can use the .spinner-rotate class to rotate a custom SVG spinner.
<path d="M8 1V4"/>
<path opacity="0.8" d="M3.05 3.05L5.17 5.17"/>
<path opacity="0.6" d="M4 8L1 8"/>
<path opacity="0.5" d="M5.17 10.83L3.05 12.95"/>
<path opacity="0.4" d="M8 12V15"/>
<path opacity="0.3" d="M10.83 10.83L12.95 12.95"/>
<path opacity="0.2" d="M15 8L12 8"/>
<path opacity="0.1" d="M12.95 3.05L10.83 5.17"/>
</svg>`} />
CSS
Variables
Border spinner tokens:
Growing spinner tokens:
Keyframes
Used for creating the CSS animations for our spinners. Included in scss/_spinner.scss.
