Buttons

Vue Bootstrap 5 Buttons component

Use MDB custom button styles for actions in forms, dialogs, and more with support for multiple sizes, states, and more.

Note: Read the API tab to find all available options and advanced customization


Basic example

        
            
            <template>
              <MDBBtn color="primary">Primary</MDBBtn>
            </template>
          
        
    
        
            
            <script>
              import { MDBBtn } from "mdb-vue-ui-kit";
              export default {
                components: {
                  MDBBtn
                }
              };
            </script>
          
        
    

Disable text wrapping

If you don’t want the button text to wrap, you can add the .text-nowrap> class to the button. In Sass, you can set $btn-white-space: nowrap> to disable text wrapping for each button.


Colors

MDB includes several predefined button styles, each serving its own semantic purpose, with a few extras thrown in for more control.

        
            
            <template>
              <MDBBtn color="primary">Primary</MDBBtn>
              <MDBBtn color="secondary">Secondary</MDBBtn>
              <MDBBtn color="success">Success</MDBBtn>
              <MDBBtn color="danger">Danger</MDBBtn>
              <MDBBtn color="warning">Warning</MDBBtn>
              <MDBBtn color="info">Info</MDBBtn>
              <MDBBtn color="light">Light</MDBBtn>
              <MDBBtn color="dark">Dark</MDBBtn>
              <MDBBtn color="link">Link</MDBBtn>
            </template>
          
        
    
        
            
            <script>
              import { MDBBtn } from "mdb-vue-ui-kit";
              export default {
                components: {
                  MDBBtn
                }
              };
            </script>
          
        
    

Conveying meaning to assistive technologies:
Using color to add meaning only provides a visual indication, which will not be conveyed to users of assistive technologies – such as screen readers. Ensure that information denoted by the color is either obvious from the content itself (e.g. the visible text), or is included through alternative means, such as additional text hidden with the .visually-hidden class.


Outline

In need of a button, but not the hefty background colors they bring? Add outline property to remove all background images and colors on any button.

        
            
            <template>
              <MDBBtn outline="primary">Primary</MDBBtn>
              <MDBBtn outline="secondary">Secondary</MDBBtn>
              <MDBBtn outline="success">Success</MDBBtn>
              <MDBBtn outline="danger">Danger</MDBBtn>
              <MDBBtn outline="warning">Warning</MDBBtn>
              <MDBBtn outline="info">Info</MDBBtn>
              <MDBBtn outline="light">Light</MDBBtn>
              <MDBBtn outline="dark">Dark</MDBBtn>
            </template>
          
        
    
        
            
            <script>
              import { MDBBtn } from "mdb-vue-ui-kit";
              export default {
                components: {
                  MDBBtn
                }
              };
            </script>
          
        
    

Some of the button styles use a relatively light foreground color, and should only be used on a dark background in order to have sufficient contrast.


Rounded

Add rounded property to make the button rounded.

        
            
            <template>
              <MDBBtn color="primary" rounded>Primary</MDBBtn>
              <MDBBtn color="secondary" rounded>Secondary</MDBBtn>
              <MDBBtn color="success" rounded>Success</MDBBtn>
              <MDBBtn color="danger" rounded>Danger</MDBBtn>
              <MDBBtn color="warning" rounded>Warning</MDBBtn>
              <MDBBtn color="info" rounded>Info</MDBBtn>
              <MDBBtn color="light" rounded>Light</MDBBtn>
              <MDBBtn color="dark" rounded>Dark</MDBBtn>
            </template>
          
        
    
        
            
            <script>
              import { MDBBtn } from "mdb-vue-ui-kit";
              export default {
                components: {
                  MDBBtn
                }
              };
            </script>
          
        
    

Rounded outline

You can use outline and rounded properties together to make the button outline and rounded at the same time.

        
            
            <template>
              <MDBBtn outline="primary" rounded>Primary</MDBBtn>
              <MDBBtn outline="secondary" rounded>Secondary</MDBBtn>
              <MDBBtn outline="success" rounded>Success</MDBBtn>
              <MDBBtn outline="danger" rounded>Danger</MDBBtn>
              <MDBBtn outline="warning" rounded>Warning</MDBBtn>
              <MDBBtn outline="info" rounded>Info</MDBBtn>
              <MDBBtn outline="light" rounded>Light</MDBBtn>
              <MDBBtn outline="dark" rounded>Dark</MDBBtn>
            </template>
          
        
    
        
            
            <script>
              import { MDBBtn } from "mdb-vue-ui-kit";
              export default {
                components: {
                  MDBBtn
                }
              };
            </script>
          
        
    

Floating

Use floating property to make a circle button.

To make it works properly you have to put an icon inside. The text will not fit in. You can find hundreds of available icons in our icons docs.

        
            
            <template>
              <MDBBtn color="primary" floating>
                <MDBIcon icon="download"></MDBIcon>
              </MDBBtn>
            </template>
          
        
    
        
            
            <script>
              import { MDBBtn, MDBIcon } from "mdb-vue-ui-kit";
              export default {
                components: {
                  MDBBtn,
                  MDBIcon
                }
              };
            </script>
          
        
    

You can apply almost all the same classes and attributes to the floating buttons as to the regular buttons - colors, ripples, sizes, outline, etc.

        
            
            <template>
              <MDBBtn color="primary" floating size="lg">
                <MDBIcon iconStyle="fab" icon="facebook-f"></MDBIcon>
              </MDBBtn>
              <MDBBtn outline="success" floating>
                <MDBIcon icon="star"></MDBIcon>
              </MDBBtn>
              <MDBBtn color="danger" floating>
                <MDBIcon icon="magic"></MDBIcon>
              </MDBBtn>
              <MDBBtn color="dark" floating>
                <MDBIcon iconStyle="fab" icon="apple"></MDBIcon>
              </MDBBtn>
            </template>
          
        
    
        
            
            <script>
              import { MDBBtn, MDBIcon } from "mdb-vue-ui-kit";
              export default {
                components: {
                  MDBBtn,
                  MDBIcon
                }
              };
            </script>
          
        
    

Social

Combining our icons and custom colors you can create social buttons. Combining our icons and custom colors you can create social buttons.

In the example below, we place a Facebook icon <MDBIcon iconStyle="fab" icon="facebook-f"></MDBIcon> inside the button and set a background-color to #3B5998 (facebook brand color).

        
            
            <template>
              <MDBBtn tag="a" color="primary" href="#!" style="background-color: rgb(59, 89, 152);">
                <MDBIcon iconStyle="fab" icon="facebook-f"></MDBIcon>
              </MDBBtn>
            </template>
          
        
    
        
            
            <script>
              import { MDBBtn, MDBIcon } from "mdb-vue-ui-kit";
              export default {
                components: {
                  MDBBtn,
                  MDBIcon
                }
              };
            </script>
          
        
    

Sample brands

A few the most popular brands in form of social buttons.

        
            
              <template>
                <MDBBtn tag="a" color="primary" href="#!" style="background-color: rgb(59, 89, 152);">
                  <MDBIcon iconStyle="fab" icon="facebook-f"></MDBIcon>
                </MDBBtn>
                <MDBBtn tag="a" color="primary" href="#!" style="background-color: rgb(85, 172, 238);">
                  <MDBIcon iconStyle="fab" icon="twitter"></MDBIcon>
                </MDBBtn>
                <MDBBtn tag="a" color="primary" href="#!" style="background-color: rgb(221, 75, 57);">
                  <MDBIcon iconStyle="fab" icon="google"></MDBIcon>
                </MDBBtn>
                <MDBBtn tag="a" color="primary" href="#!" style="background-color: rgb(172, 43, 172);">
                  <MDBIcon iconStyle="fab" icon="instagram"></MDBIcon>
                </MDBBtn>
                <MDBBtn tag="a" color="primary" href="#!" style="background-color: rgb(0, 130, 202);">
                  <MDBIcon iconStyle="fab" icon="linkedin-in"></MDBIcon>
                </MDBBtn>
                <MDBBtn tag="a" color="primary" href="#!" style="background-color: rgb(198, 17, 24);">
                  <MDBIcon iconStyle="fab" icon="pinterest"></MDBIcon>
                </MDBBtn>
                <MDBBtn tag="a" color="primary" href="#!" style="background-color: rgb(76, 117, 163);">
                  <MDBIcon iconStyle="fab" icon="vk"></MDBIcon>
                </MDBBtn>
                <MDBBtn tag="a" color="primary" href="#!" style="background-color: rgb(255, 172, 68);">
                  <MDBIcon iconStyle="fab" icon="stack-overflow"></MDBIcon>
                </MDBBtn>
                <MDBBtn tag="a" color="primary" href="#!" style="background-color: rgb(237, 48, 47);">
                  <MDBIcon iconStyle="fab" icon="youtube"></MDBIcon>
                </MDBBtn>
                <MDBBtn tag="a" color="primary" href="#!" style="background-color: rgb(72, 20, 73);">
                  <MDBIcon iconStyle="fab" icon="slack-hash"></MDBIcon>
                </MDBBtn>
                <MDBBtn tag="a" color="primary" href="#!" style="background-color: rgb(51, 51, 51);">
                  <MDBIcon iconStyle="fab" icon="github"></MDBIcon>
                </MDBBtn>
                <MDBBtn tag="a" color="primary" href="#!" style="background-color: rgb(236, 74, 137);">
                  <MDBIcon iconStyle="fab" icon="dribbble"></MDBIcon>
                </MDBBtn>
                <MDBBtn tag="a" color="primary" href="#!" style="background-color: rgb(255, 69, 0);">
                  <MDBIcon iconStyle="fab" icon="reddit-alien"></MDBIcon>
                </MDBBtn>
                <MDBBtn tag="a" color="primary" href="#!" style="background-color: rgb(37, 211, 102);">
                  <MDBIcon iconStyle="fab" icon="whatsapp"></MDBIcon>
                </MDBBtn>
              </template>
            
        
    
        
            
              <script>
                import { MDBBtn, MDBIcon } from "mdb-vue-ui-kit";
                export default {
                  components: {
                    MDBBtn,
                    MDBIcon
                  }
                };
              </script>
            
        
    

Floating social

By adding floating property you can create a nice, floating social button.

        
            
              <template>
                <MDBBtn tag="a" color="primary" href="#!" floating size="lg" style="background-color: rgb(172, 43, 172);">
                  <MDBIcon iconStyle="fab" icon="instagram"></MDBIcon>
                </MDBBtn>
              </template>
            
        
    
        
            
              <script>
                import { MDBBtn, MDBIcon } from "mdb-vue-ui-kit";
                export default {
                  components: {
                    MDBBtn,
                    MDBIcon
                  }
                };
              </script>
            
        
    

Text

You don't need to use only an icon. You can add text to the button. Remember to add some spacing classes (for example .me-2) to provide a proper space between icon and text.

        
            
              <template>
                <MDBBtn tag="a" color="primary" href="#!" style="background-color: rgb(85, 172, 238);">
                  <MDBIcon iconStyle="fab" icon="twitter" class="me-2"></MDBIcon>Twitter
                </MDBBtn>
              </template>
            
        
    
        
            
              <script>
                import { MDBBtn, MDBIcon } from "mdb-vue-ui-kit";
                export default {
                  components: {
                    MDBBtn,
                    MDBIcon
                  }
                };
              </script>
            
        
    

Only icon

By removing button classes and replacing background-color with color you can create minimalistic, clickable icons.

        
            
              <template>
                <a class="m-1" href="#!" role="button" style="color: rgb(59, 89, 152);">
                  <MDBIcon iconStyle="fab" icon="facebook-f" size="lg"></MDBIcon>
                </a>
                <a class="m-1" href="#!" role="button" style="color: rgb(85, 172, 238);">
                  <MDBIcon iconStyle="fab" icon="twitter" size="lg"></MDBIcon>
                </a>
                <a class="m-1" href="#!" role="button" style="color: rgb(221, 75, 57);">
                  <MDBIcon iconStyle="fab" icon="google" size="lg"></MDBIcon>
                </a>
                <a class="m-1" href="#!" role="button" style="color: rgb(172, 43, 172);">
                  <MDBIcon iconStyle="fab" icon="instagram" size="lg"></MDBIcon>
                </a>
              </template>
            
        
    
        
            
              <script>
                import { MDBBtn, MDBIcon } from "mdb-vue-ui-kit";
                export default {
                  components: {
                    MDBBtn,
                    MDBIcon
                  }
                };
              </script>
            
        
    

Notifications

By using a badge you can create a button with a notification to provide a counter.

        
            
              <template>
                <MDBBtn tag="a" color="primary" href="#!" style="background-color: rgb(59, 89, 152);">
                  <MDBIcon iconStyle="fab" icon="facebook-f"></MDBIcon>
                  <MDBBadge color="danger" class="ms-2">8</MDBBadge>
                </MDBBtn>
              </template>
            
        
    
        
            
              <script>
                import { MDBBtn, MDBIcon, MDBBadge } from "mdb-vue-ui-kit";
                export default {
                  components: {
                    MDBBtn,
                    MDBIcon,
                    MDBBadge
                  }
                };
              </script>
            
        
    

Tags

The MDBBtn component is designed to be used with the <button> element. However, you can also use it on <a> or <input> elements (though some browsers may apply a slightly different rendering).

When using button classes on <a> elements that are used to trigger in-page functionality (like collapsing content), rather than linking to new pages or sections within the current page, these links should be given a role="button" to appropriately convey their purpose to assistive technologies such as screen readers.

        
            
            <template>
              <MDBBtn tag="a" color="primary" href="#">Link</MDBBtn>
              <MDBBtn color="primary" href="#" type="submit">Button</MDBBtn>
              <MDBBtn tag="input" color="primary" type="button" value="Input"></MDBBtn>
              <MDBBtn tag="input" color="primary" type="submit" value="Submit"></MDBBtn>
              <MDBBtn tag="input" color="primary" type="reset" value="Reset"></MDBBtn>
            </template>
          
        
    
        
            
            <script>
              import { MDBBtn } from "mdb-vue-ui-kit";
              export default {
                components: {
                  MDBBtn
                }
              };
            </script>
          
        
    

Sizes

Fancy larger or smaller buttons? Add size="lg" or size="sm" for additional sizes.

        
            
            <template>
              <MDBBtn color="primary" size="sm">Button</MDBBtn>
              <MDBBtn color="primary">Button</MDBBtn>
              <MDBBtn color="primary" size="lg">Button</MDBBtn>
            </template>
          
        
    
        
            
            <script>
              import { MDBBtn } from "mdb-vue-ui-kit";
              export default {
                components: {
                  MDBBtn
                }
              };
            </script>
          
        
    

Active state

Add .active class to make the button look pressed.

        
            
            <template>
              <MDBBtn tag="a" color="primary" size="lg" class="active" aria-pressed="true">Primary link</MDBBtn>
              <MDBBtn tag="a" color="secondary" size="lg" class="active" aria-pressed="true">Link</MDBBtn>
            </template>
          
        
    
        
            
            <script>
              import { MDBBtn } from "mdb-vue-ui-kit";
              export default {
                components: {
                  MDBBtn
                }
              };
            </script>
          
        
    

Disabled state

Make buttons look inactive by adding the disabled boolean attribute to any MDBBtn element. Disabled buttons have pointer-events: none applied to, preventing hover and active states from triggering.

        
            
            <template>
              <MDBBtn color="primary" size="lg" disabled>Primary button</MDBBtn>
              <MDBBtn color="secondary" size="lg" disabled>Button</MDBBtn>
            </template>
          
        
    
        
            
            <script>
              import { MDBBtn } from "mdb-vue-ui-kit";
              export default {
                components: {
                  MDBBtn
                }
              };
            </script>
          
        
    

Disabled MDBBtn using the a tag behave a bit different:

  • <a>s don’t support the disabled attribute, so you must add the .disabled class to make it visually appear disabled.
  • Some future-friendly styles are included to disable all pointer-events on anchor buttons. In browsers which support that property, you won’t see the disabled cursor at all.
  • Disabled buttons should include the aria-disabled="true" attribute to indicate the state of the element to assistive technologies.
        
            
            <template>
              <MDBBtn tag="a" color="primary" size="lg" class="disabled" tabindex="-1" aria-disabled="true">Primary link</MDBBtn>
              <MDBBtn tag="a" color="secondary" size="lg" class="disabled" tabindex="-1" aria-disabled="true">Link</MDBBtn>
            </template>
          
        
    
        
            
            <script>
              import { MDBBtn } from "mdb-vue-ui-kit";
              export default {
                components: {
                  MDBBtn
                }
              };
            </script>
          
        
    

Link functionality caveat:
The .disabled class uses pointer-events: none to try to disable the link functionality of <a>s, but that CSS property is not yet standardized. In addition, even in browsers that do support pointer-events: none, keyboard navigation remains unaffected, meaning that sighted keyboard users and users of assistive technologies will still be able to activate these links. So to be safe, add a tabindex="-1" attribute on these links (to prevent them from receiving keyboard focus) and use custom JavaScript to disable their functionality.


Block buttons

Create responsive stacks of full-width, “block buttons” like those in Bootstrap 4 with a mix of our display and gap utilities. By using utilities instead of button specific classes, we have much greater control over spacing, alignment, and responsive behaviors.

        
            
            <template>
              <div class="d-grid gap-2">
                <MDBBtn color="primary">Button</MDBBtn>
                <MDBBtn color="primary">Button</MDBBtn>
              </div>
            </template>
          
        
    
        
            
            <script>
              import { MDBBtn } from "mdb-vue-ui-kit";
              export default {
                components: {
                  MDBBtn
                }
              };
            </script>
          
        
    

Here we create a responsive variation, starting with vertically stacked buttons until the md breakpoint, where .d-md-block replaces the .d-grid class, thus nullifying the gap-2 utility. Resize your browser to see them change.

        
            
            <template>
              <div class="d-grid gap-2 d-md-block">
                <MDBBtn color="primary">Button</MDBBtn>
                <MDBBtn color="primary">Button</MDBBtn>
              </div>
            </template>
          
        
    
        
            
            <script>
              import { MDBBtn } from "mdb-vue-ui-kit";
              export default {
                components: {
                  MDBBtn
                }
              };
            </script>
          
        
    

You can adjust the width of your block buttons with grid column width classes. For example, for a half-width “block button”, use .col-6. Center it horizontally with .mx-auto, too.

        
            
            <template>
              <div class="d-grid gap-2 col-6 mx-auto">
                <MDBBtn color="primary">Button</MDBBtn>
                <MDBBtn color="primary">Button</MDBBtn>
              </div>
            </template>
          
        
    
        
            
            <script>
              import { MDBBtn } from "mdb-vue-ui-kit";
              export default {
                components: {
                  MDBBtn
                }
              };
            </script>
          
        
    

Additional utilities can be used to adjust the alignment of buttons when horizontal. Here we’ve taken our previous responsive example and added some flex utilities and a margin utility on the button to right align the buttons when they’re no longer stacked.

        
            
            <template>
              <div class="d-grid gap-2 d-md-flex justify-content-md-end">
                <MDBBtn class="me-md-2" color="primary">Button</MDBBtn>
                <MDBBtn color="primary">Button</MDBBtn>
              </div>
            </template>
          
        
    
        
            
            <script>
              import { MDBBtn } from "mdb-vue-ui-kit";
              export default {
                components: {
                  MDBBtn
                }
              };
            </script>
          
        
    

Toggle states

Add toggler<> and v-model:toggle<> props to toggle a button’s active<> state.

        
            
            <template>
              <MDBBtn v-model:toggle="toggleBtn1" toggler color="primary" autocomplete="off">Toggle button</MDBBtn>
              <MDBBtn v-model:toggle="toggleBtn2" toggler color="primary" autocomplete="off" aria-pressed="true">Active toggle button</MDBBtn>
              <MDBBtn v-model:toggle="toggleBtn3" toggler color="primary" autocomplete="off" disabled>Disabled toggle button</MDBBtn>
            </template>
          
        
    
        
            
            <script>
              import { MDBBtn } from "mdb-vue-ui-kit";
              import { ref } from "vue";
              export default {
                components: {
                  MDBBtn
                },
                setup() {
                  const toggleBtn1 = ref(false);
                  const toggleBtn2 = ref(true);
                  const toggleBtn3 = ref(false);
                  return {
                    toggleBtn1,
                    toggleBtn2,
                    toggleBtn3
                  };
                }
              };
            </script>
          
        
    
        
            
            <template>
              <MDBBtn v-model:toggle="toggleLink1" toggler tag="a" color="primary" autocomplete="off">Toggle link</MDBBtn>
              <MDBBtn v-model:toggle="toggleLink2" toggler tag="a" color="primary" autocomplete="off" aria-pressed="true">Active toggle link</MDBBtn>
              <MDBBtn v-model:toggle="toggleLink3" toggler tag="a" color="primary" autocomplete="off" class="disabled">Disabled toggle link</MDBBtn>
            </template>
          
        
    
        
            
            <script>
              import { MDBBtn } from "mdb-vue-ui-kit";
              import { ref } from "vue";
              export default {
                components: {
                  MDBBtn
                },
                setup() {
                  const toggleLink1 = ref(false);
                  const toggleLink2 = ref(true);
                  const toggleLink3 = ref(false);
                  return {
                    toggleLink1,
                    toggleLink2,
                    toggleLink3
                  };
                }
              };
            </script>
          
        
    

Buttons - API


Import

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

Properties

Property Type Default Description
color String "" Changes button color
size String "" Changes button size
outline String "" Changes button style and color to outline
rounded Boolean false Changes button style to rounded
floating Boolean false Changes button style to floating
toggler Boolean false Enables toggling
toggle Boolean false Defines toggle state
role String "button" Defines button's role
ripple [Object, Boolean] true Defines ripple configuration or disables it if false.
type String "button" Defines button's type
tag String "button" Defines button's tag

Events

Event type Description
toggle Fires immediately when the toggler button is clicked. Returns toggle state (true/false).