Spinners

Vue Bootstrap 5 Spinner component

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


Basic example

Use the MDBSpinner for a lightweight loading indicator.

Loading...

          <template>
            <MDBSpinner />
          </template>
        

          <script>
            import { MDBSpinner } from "mdb-vue-ui-kit";

            export default {
              components: {
                MDBSpinner
              }
            };
          </script>
        

MDB “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 includes role="status" and a nested <span class="visually-hidden">Loading...</span>.


Colors

The border spinner uses currentColor for its border-color, meaning you can customize the color with text color utilities. You can use any of our text color utilities within color prop on the standard spinner.

Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...

          <template>
            <MDBSpinner color="primary" />
            <MDBSpinner color="secondary" />
            <MDBSpinner color="success" />
            <MDBSpinner color="danger" />
            <MDBSpinner color="warning" />
            <MDBSpinner color="info" />
            <MDBSpinner color="light" />
            <MDBSpinner color="dark" />
          </template>
        

          <script>
            import { MDBSpinner } from "mdb-vue-ui-kit";

            export default {
              components: {
                MDBSpinner
              }
            };
          </script>
        

Growing spinner

If you don’t fancy a border spinner, switch to the grow spinner with grow prop. While it doesn’t technically spin, it does repeatedly grow!

Loading...

           <template>
             <MDBSpinner grow/>
           </template>
        

          <script>
            import { MDBSpinner } from "mdb-vue-ui-kit";

            export default {
              components: {
                MDBSpinner
              }
            };
          </script>
        

Once again, this spinner is built with currentColor, so you can easily change its appearance with text color utilities within a color prop. Here it is in blue, along with the supported variants.

Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...

          <template>
            <MDBSpinner grow color="primary" />
            <MDBSpinner grow color="secondary" />
            <MDBSpinner grow color="success" />
            <MDBSpinner grow color="danger" />
            <MDBSpinner grow color="warning" />
            <MDBSpinner grow color="info" />
            <MDBSpinner grow color="light" />
            <MDBSpinner grow color="dark" />
          </template>
        

          <script>
            import { MDBSpinner } from "mdb-vue-ui-kit";

            export default {
              components: {
                MDBSpinner
              }
            };
          </script>
        

Alignment

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

Margin

Use margin utilities like .m-5 for easy spacing.

Loading...

            <template>
              <MDBSpinner class="m-5" />
            </template>
          

            <script>
              import { MDBSpinner } from "mdb-vue-ui-kit";

              export default {
                components: {
                  MDBSpinner
                }
              };
            </script>
          

Flex

Use flexbox utilities, float utilities, or text alignment utilities to place spinners exactly where you need them in any situation.

Loading...

            <div class="d-flex justify-content-center">
              <template>
                <MDBSpinner />   
              </template>   
            </div>
          

            <script>
              import { MDBSpinner } from "mdb-vue-ui-kit";

              export default {
                components: {
                  MDBSpinner
                }
              };
            </script>
          
Loading...

            <script>
              <template>
                <div class="d-flex align-items-center">
                  <strong>Loading...</strong>
                  <MDBSpinner class="ms-auto" />
                </div>
              </template>
            </script>
          

            <script>
              import { MDBSpinner } from "mdb-vue-ui-kit";

              export default {
                components: {
                  MDBSpinner
                }
              };
            </script>
          

Floats

Loading...

            <template>
              <div class="clearfix">
                <MDBSpinner class="float-end"/>
              </div>
            </template>
          

            <script>
              import { MDBSpinner } from "mdb-vue-ui-kit";

              export default {
                components: {
                  MDBSpinner
                }
              };
            </script>
          

Text align

Loading...

            <template>
              <div class="text-center">
                <MDBSpinner />
              </div>
            </template>
          

            <script>
              import { MDBSpinner } from "mdb-vue-ui-kit";

              export default {
                components: {
                  MDBSpinner
                }
              };
            </script>
          

Size

Add size="sm" to make a smaller spinner that can quickly be used within other components.

Loading...
Loading...

          <template>
            <MDBSpinner size="sm" />
            <MDBSpinner grow size="sm" />
          </template>
        

          <script>
            import { MDBSpinner } from "mdb-vue-ui-kit";

            export default {
              components: {
                MDBSpinner
              }
            };
          </script>
        

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

Loading...
Loading...

          <template>
            <MDBSpinner style="width: 3rem; height: 3rem" />
            <MDBSpinner grow style="width: 3rem; height: 3rem" />
          </template>
        

          <script>
            import { MDBSpinner } from "mdb-vue-ui-kit";

            export default {
              components: {
                MDBSpinner
              }
            };
          </script>
        

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.

Border spinner


            <template>
              <MDBBtn color="primary" disabled>
                <MDBSpinner tag="span" size="sm" />
              </MDBBtn>
              <MDBBtn color="primary" disabled>
                <MDBSpinner tag="span" size="sm" />
                Loading...
              </MDBBtn>
            </template>
          

            <script>
              import { MDBSpinner, MDBBtn } from "mdb-vue-ui-kit";

              export default {
                components: {
                  MDBSpinner,
                  MDBBtn
                }
              };
            </script>
          

Growing spinner


            <template>
              <MDBBtn color="primary" disabled>
                <MDBSpinner tag="span" grow size="sm" />
              </MDBBtn>
              <MDBBtn color="primary" disabled>
                <MDBSpinner tag="span" grow size="sm" />
                Loading...
              </MDBBtn>
            </template>
          

            <script>
              import { MDBSpinner, MDBBtn } from "mdb-vue-ui-kit";

              export default {
                components: {
                  MDBSpinner,
                  MDBBtn
                }
              };
            </script>
          

Spinners - API


Import


        <script>
          import { 
            MDBSpinner 
          } from 'mdb-vue-ui-kit';
        </script>
      

Properties

Name Type Default Description Example
tag String 'div' Defines tag of the MDBSpinner element <MDBSpinner tag="section" />
grow Boolean false Creates spinner grow instead of spin <MDBSpinner grow />
color String Changes spinner's color <MDBSpinner color="primary" />
size String Changes spinner's size <MDBSpinner size="sm" />