Bootstrap 5 Spinners


Spinners are used to indicate loading or processing content. Bootstrap provides a set of utility classes to create spinners. Spinners can be applied to buttons, form controls, or any other element to show that some action is in progress.

Border spinner

  • .spinner-border class is used to create a standard spinner.
Example
<div class="spinner-border"></div>
Try it Yourself

Colored Spinners

  • Text color classes are used to set the color of the spinner (e.g., .text-primary , .text-success)
Example
<div class="spinner-border text-primary"></div>
<div class="spinner-border text-success"></div>
<div class="spinner-border text-info"></div>
<div class="spinner-border text-warning"></div>
<div class="spinner-border text-danger"></div>
<div class="spinner-border text-secondary"></div>
<div class="spinner-border text-muted"></div>
<div class="spinner-border text-dark"></div>
<div class="spinner-border text-light"></div>
Try it Yourself

Spinner Grow

  • .spinner-grow class is used to create a spinner that appears to grow in size.
Example
<div class="spinner-grow text-primary"></div>
<div class="spinner-grow text-success"></div>
<div class="spinner-grow text-info"></div>
<div class="spinner-grow text-warning"></div>
<div class="spinner-grow text-danger"></div>
<div class="spinner-grow text-secondary"></div>
<div class="spinner-grow text-muted"></div>
<div class="spinner-grow text-dark"></div>
<div class="spinner-grow text-light"></div>
Try it Yourself

Spinner Size

  • Add .spinner-border-sm and .spinner-grow-sm to make a smaller spinners.
Example
<div class="spinner-border text-primary spinner-border-sm"></div>
<div class="spinner-grow text-primary spinner-grow-sm"></div>
Try it Yourself

Spinner Buttons

  • You can combine spinners with buttons to create loading indicators with or without text.
Example
<button class="btn btn-primary">
  <span class="spinner-border spinner-border-sm"></span>
</button>

<button class="btn btn-primary">
  <span class="spinner-border spinner-border-sm"></span>
  Processing...
</button>

<button class="btn btn-primary">
  <span class="spinner-grow spinner-grow-sm"></span>
</button>

<button class="btn btn-primary">
  <span class="spinner-grow spinner-grow-sm"></span>
  Processing...
</button>
Try it Yourself