Movatterモバイル変換


[0]ホーム

URL:


Framework:


Hire Us Get CoreUI PRO all-access

Bootstrap 5 Spinners

Spinners

Indicate the loading state of a component or page with Bootstrap spinners, built entirely with HTML, CSS, and no JavaScript.

🤖 Looking for the LLM-optimized version?View llm.md

Other frameworks

CoreUI components are available as native Angular, React, and Vue components. To learn more please visit the following pages.

On this page

About

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 will, however, need some custom JavaScript to toggle their visibility. Their appearance, alignment, and sizing can be easily customized with our amazing utility classes.

For accessibility purposes, each loader here includesrole="status" and a nested<span class="visually-hidden">Loading...</span>.

This component's animation effect relies on theprefers-reduced-motion media query. For more information, refer to thereduced motion section of our accessibility documentation.

Border spinner

Use the border spinners for a lightweight loading indicator.

Loading...
html
<divclass="spinner-border"role="status"><spanclass="visually-hidden">Loading...</span></div>

Colors

The border spinner usescurrentColor for itsborder-color, meaning you can customize the color withtext color utilities. You can use any of our text color utilities on the standard spinner.

Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
html
<divclass="spinner-border text-primary"role="status"><spanclass="visually-hidden">Loading...</span></div><divclass="spinner-border text-secondary"role="status"><spanclass="visually-hidden">Loading...</span></div><divclass="spinner-border text-success"role="status"><spanclass="visually-hidden">Loading...</span></div><divclass="spinner-border text-danger"role="status"><spanclass="visually-hidden">Loading...</span></div><divclass="spinner-border text-warning"role="status"><spanclass="visually-hidden">Loading...</span></div><divclass="spinner-border text-info"role="status"><spanclass="visually-hidden">Loading...</span></div><divclass="spinner-border text-light"role="status"><spanclass="visually-hidden">Loading...</span></div><divclass="spinner-border text-dark"role="status"><spanclass="visually-hidden">Loading...</span></div>
Why not useborder-color utilities? Each border spinner specifies atransparent border for at least one side, so.border-{color} utilities would override that.

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!

Loading...
html
<divclass="spinner-grow"role="status"><spanclass="visually-hidden">Loading...</span></div>

Once again, this spinner is built withcurrentColor, so you can easily change its appearance withtext color utilities. Here it is in blue, along with the supported variants.

Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
html
<divclass="spinner-grow text-primary"role="status"><spanclass="visually-hidden">Loading...</span></div><divclass="spinner-grow text-secondary"role="status"><spanclass="visually-hidden">Loading...</span></div><divclass="spinner-grow text-success"role="status"><spanclass="visually-hidden">Loading...</span></div><divclass="spinner-grow text-danger"role="status"><spanclass="visually-hidden">Loading...</span></div><divclass="spinner-grow text-warning"role="status"><spanclass="visually-hidden">Loading...</span></div><divclass="spinner-grow text-info"role="status"><spanclass="visually-hidden">Loading...</span></div><divclass="spinner-grow text-light"role="status"><spanclass="visually-hidden">Loading...</span></div><divclass="spinner-grow text-dark"role="status"><spanclass="visually-hidden">Loading...</span></div>

Alignment

Spinners in Bootstrap are built withrems,currentColor, anddisplay: inline-flex. This means they can easily be resized, recolored, and quickly aligned.

Margin

Usemargin utilities like.m-5 for easy spacing.

Loading...
html
<divclass="spinner-border m-5"role="status"><spanclass="visually-hidden">Loading...</span></div>

Placement

Useflexbox utilities,float utilities, ortext alignment utilities to place spinners exactly where you need them in any situation.

Flex

Loading...
html
<divclass="d-flex justify-content-center"><divclass="spinner-border"role="status"><spanclass="visually-hidden">Loading...</span></div></div>
Loading...
html
<divclass="d-flex align-items-center"><strongrole="status">Loading...</strong><divclass="spinner-border ms-auto"aria-hidden="true"></div></div>

Floats

Loading...
html
<divclass="clearfix"><divclass="spinner-border float-end"role="status"><spanclass="visually-hidden">Loading...</span></div></div>

Text align

Loading...
html
<divclass="text-center"><divclass="spinner-border"role="status"><spanclass="visually-hidden">Loading...</span></div></div>

Size

Add.spinner-border-sm and.spinner-grow-sm to make a smaller spinner that can quickly be used within other components.

Loading...
Loading...
html
<divclass="spinner-border spinner-border-sm"role="status"><spanclass="visually-hidden">Loading...</span></div><divclass="spinner-grow spinner-grow-sm"role="status"><spanclass="visually-hidden">Loading...</span></div>

Or, use custom CSS or inline styles to change the dimensions as needed.

Loading...
Loading...
html
<divclass="spinner-border"style="width: 3rem; height: 3rem;"role="status"><spanclass="visually-hidden">Loading...</span></div><divclass="spinner-grow"style="width: 3rem; height: 3rem;"role="status"><spanclass="visually-hidden">Loading...</span></div>

Buttons

Use spinners within buttons to indicate an action is currently processing or taking place. You may also swap the text out of the spinner element and utilize button text as needed.

html
<buttonclass="btn btn-primary"type="button"disabled><spanclass="spinner-border spinner-border-sm"aria-hidden="true"></span><spanclass="visually-hidden"role="status">Loading...</span></button><buttonclass="btn btn-primary"type="button"disabled><spanclass="spinner-border spinner-border-sm"aria-hidden="true"></span><spanrole="status">Loading...</span></button>
html
<buttonclass="btn btn-primary"type="button"disabled><spanclass="spinner-grow spinner-grow-sm"aria-hidden="true"></span><spanclass="visually-hidden"role="status">Loading...</span></button><buttonclass="btn btn-primary"type="button"disabled><spanclass="spinner-grow spinner-grow-sm"aria-hidden="true"></span><spanrole="status">Loading...</span></button>

Customizing

CSS variables

Spinners use local CSS variables on.spinner-border and.spinner-grow for enhanced real-time customization. Values for the CSS variables are set via Sass, so Sass customization is still supported, too.

Border spinner variables:

scss/_spinners.scss
--cui-spinner-width:#{$spinner-width};--cui-spinner-height:#{$spinner-height};--cui-spinner-vertical-align:#{$spinner-vertical-align};--cui-spinner-border-width:#{$spinner-border-width};--cui-spinner-animation-speed:#{$spinner-animation-speed};--cui-spinner-animation-name:spinner-border;

Growing spinner variables:

scss/_spinners.scss
--cui-spinner-width:#{$spinner-width};--cui-spinner-height:#{$spinner-height};--cui-spinner-vertical-align:#{$spinner-vertical-align};--cui-spinner-animation-speed:#{$spinner-animation-speed};--cui-spinner-animation-name:spinner-grow;

For both spinners, small spinner modifier classes are used to update the values of these CSS variables as needed. For example, the.spinner-border-sm class does the following:

scss/_spinners.scss
--cui-spinner-width:#{$spinner-width-sm};--cui-spinner-height:#{$spinner-height-sm};--cui-spinner-border-width:#{$spinner-border-width-sm};

SASS variables

scss/_variables.scss
$spinner-width:2rem;$spinner-height:$spinner-width;$spinner-vertical-align:-.125em;$spinner-border-width:.25em;$spinner-animation-speed:.75s;$spinner-width-sm:1rem;$spinner-height-sm:$spinner-width-sm;$spinner-border-width-sm:.2em;

Keyframes

Used for creating the CSS animations for our spinners. Included inscss/_spinners.scss.

scss/_spinners.scss
@keyframesspinner-border{to{transform:rotate(360deg)#{"/* rtl:ignore */"};}}
scss/_spinners.scss
@keyframesspinner-grow{0%{transform:scale(0);}50%{opacity:1;transform:none;}}

CoreUI vs Bootstrap

While this Spinner component is fully compatible with Bootstrap and follows its core principles, CoreUI delivers a more complete solution for modern app development.

What sets CoreUI apart from Bootstrap?

  • Fully compatible with Bootstrap – Built directly on Bootstrap, all classes and behaviors work as expected.
  • 🧠Framework-native versions – CoreUI provides dedicated libraries forReact.js,Vue.js, andAngular, unlike Bootstrap which relies on third-party plugins for JavaScript frameworks.
  • 👨‍💻Maintained by a full-time team – CoreUI is developed as a professional product, not a volunteer-driven project.
  • 📦More built-in components – Includes additional ready-to-use components like range sliders, multi-selects, steppers, etc.
  • 🛠️Sass Modules support today – CoreUI already supports Sass Modules, which are planned for Bootstrap 6.
  • 🌍Better LTR/RTL support – Uses modern CSS logical properties for seamless bidirectional layout support.
  • 🔒LTS (Long-Term Support) – Bootstrap now offers LTS only via paid third parties like HeroDevs, while CoreUI continues to offer long-term support natively and for free.

Whether you’re building internal tools, dashboards, or SaaS platforms — CoreUI combines the familiarity of Bootstrap with a more powerful, scalable, and production-ready ecosystem.

👉Explore CoreUI Bootstrap Components
👉Compare CoreUI vs Bootstrap


[8]ページ先頭

©2009-2025 Movatter.jp