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>
          
        
    
        
            
            <script setup lang="ts">
              import { MDBSpinner } from "mdb-vue-ui-kit";
            </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>
          
        
    
        
            
            <script setup lang="ts">
              import { MDBSpinner } from "mdb-vue-ui-kit";
            </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>
          
        
    
        
            
          <script setup lang="ts">
            import { MDBSpinner } from "mdb-vue-ui-kit";
          </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>
          
        
    
        
            
          <script setup lang="ts">
            import { MDBSpinner } from "mdb-vue-ui-kit";
          </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>
            
        
    
        
            
            <script setup lang="ts">
              import { MDBSpinner } from "mdb-vue-ui-kit";
            </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>
            
        
    
        
            
              <script setup lang="ts">
                import { MDBSpinner } from "mdb-vue-ui-kit";
              </script>
            
        
    
Loading...
        
            
                <template>
                  <div class="d-flex align-items-center">
                    <strong>Loading...</strong>
                    <MDBSpinner class="ms-auto" />
                  </div>
                </template>
              
        
    
        
            
                <script>
                  import { MDBSpinner } from "mdb-vue-ui-kit";
                  export default {
                    components: {
                      MDBSpinner
                    }
                  };
                </script>
              
        
    
        
            
                <script setup lang="ts">
                  import { MDBSpinner } from "mdb-vue-ui-kit";
                </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>
              
        
    
        
            
                <script setup lang="ts">
                  import { MDBSpinner } from "mdb-vue-ui-kit";
                </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>
              
        
    
        
            
                <script setup lang="ts">
                  import { MDBSpinner } from "mdb-vue-ui-kit";
                </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>
            
        
    
        
            
              <script setup lang="ts">
                import { MDBSpinner } from "mdb-vue-ui-kit";
              </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>
            
        
    
        
            
              <script setup lang="ts">
                import { MDBSpinner } from "mdb-vue-ui-kit";
              </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>
              
        
    
        
            
                <script setup lang="ts">
                  import { MDBSpinner, MDBBtn } from "mdb-vue-ui-kit";
                </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>
             
        
    
        
            
             <script setup lang="ts">
               import { MDBSpinner, MDBBtn } from "mdb-vue-ui-kit";
             </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" />

CSS variables

As part of MDB's evolving CSS variables approach, spinners now 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:

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

          // .spinner-border-sm
          --#{$prefix}spinner-width: #{$spinner-width-sm};
          --#{$prefix}spinner-height: #{$spinner-height-sm};
          --#{$prefix}spinner-border-width: #{$spinner-border-width-sm};

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

          // .spinner-grow-sm
          --#{$prefix}spinner-width: #{$spinner-width-sm};
          --#{$prefix}spinner-height: #{$spinner-height-sm};
          
        
    

SCSS variables

        
            
        $spinner-width: 2rem;
        $spinner-height: $spinner-width;
        $spinner-vertical-align: -0.125em;
        $spinner-border-width: 0.25em;
        $spinner-animation-speed: 0.75s;

        $spinner-width-sm: 1rem;
        $spinner-height-sm: $spinner-width-sm;
        $spinner-border-width-sm: 0.2em;