Vue Bootstrap Buttons

Vue Buttons - Bootstrap 4 & Material Design

Use Vue Bootstrap custom button styles for actions in forms, dialogs, and more. Includes support for a handful of contextual variations, sizes, states, and more.


Basic buttons

MDB includes 7 predefined button styles, each serving its own semantic purpose.


                    <template>
                        <div>
                            <!-- Provides extra visual weight and identifies the primary action in a set of buttons -->
                            <mdb-btn color="primary">Primary</mdb-btn>

                            <!-- Default button -->
                            <mdb-btn color="default">Default</mdb-btn>

                            <!-- Secondary button -->
                            <mdb-btn color="secondary">Secondary</mdb-btn>

                            <!-- Indicates a successful or positive action -->
                            <mdb-btn color="success">Success</mdb-btn>

                            <!-- Contextual button for informational alert messages -->
                            <mdb-btn color="info">Info</mdb-btn>

                            <!-- Indicates caution should be taken with this action -->
                            <mdb-btn color="warning">Warning</mdb-btn>

                            <!-- Indicates a dangerous or potentially negative action -->
                            <mdb-btn color="danger">Danger</mdb-btn>
                        </div>    
                    </template>
                

                    <script>
                        import { mdbBtn } from 'mdbvue';
                        export default {
                            name: 'ButtonPage',
                            components: {
                                mdbBtn
                            }
                        } 
                    </script>
                

Conveying meaning to assistive technologies

Using color to add meaning to a button 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 (the visible text of the button), or is included through alternative means, such as additional text hidden with the .sr-only class.


Additional buttons


                    <template>
                        <div>
                            <!--Elegant-->
                            <mdb-btn color="elegant">Elegant</mdb-btn>

                            <!--Unique-->
                            <mdb-btn color="unique">Unique</mdb-btn>

                            <!--Pink-->
                            <mdb-btn color="pink">Pink</mdb-btn>

                            <!--Purple-->
                            <mdb-btn color="purple">Purple</mdb-btn>

                            <!--Deep-purple-->
                            <mdb-btn color="deep-purple">Deep-purple</mdb-btn>

                            <!--Indigo-->
                            <mdb-btn color="indigo">Indigo</mdb-btn>

                            <!--Light blue-->
                            <mdb-btn color="light-blue">Light blue</mdb-btn>

                            <!--Cyan-->
                            <mdb-btn color="cyan">Cyan</mdb-btn>

                            <!--Dark-green-->
                            <mdb-btn color="dark-green">Dark-green</mdb-btn>

                            <!--Light-green-->
                            <mdb-btn color="light-green">Light-green</mdb-btn>

                            <!--Yellow-->
                            <mdb-btn color="yellow">Yellow</mdb-btn>

                            <!--Amber-->
                            <mdb-btn color="amber">Amber</mdb-btn>

                            <!--Deep-orange-->
                            <mdb-btn color="deep-orange">Deep-orange</mdb-btn>

                            <!--Brown-->
                            <mdb-btn color="brown">Brown</mdb-btn>

                            <!--Blue-grey-->
                            <mdb-btn color="blue-grey">Blue-grey</mdb-btn>

                            <!--MDB-->
                            <mdb-btn color="mdb-color">MDB</mdb-btn>
                        </div>
                    </template>
                

                    <script>
                        import { mdbBtn } from 'mdbvue';
                        export default {
                            name: 'ButtonPage',
                            components: {
                                mdbBtn
                            }
                        } 
                    </script>
                

Gradient buttons MDB Pro component


                    <template>
                        <div>
                            <mdb-btn gradient="peach" rounded>Peach gradient button</mdb-btn>
                            <mdb-btn gradient="purple" rounded>Purple gradient button</mdb-btn>
                            <mdb-btn gradient="blue" rounded>Blue gradient button</mdb-btn>
                            <mdb-btn gradient="aqua" rounded>Aqua gradient button</mdb-btn>
                        </div>
                    </template>
                

                    <script>
                        import { mdbBtn } from 'mdbvue';
                        export default {
                            name: 'ButtonPage',
                            components: {
                                mdbBtn
                            }
                        } 
                    </script>
                

Outline buttons

In need of a button, but not the hefty background colors they bring? Replace the default modifier classes with the outline ones to remove all background images and colors on any button.


                    <template>
                        <div>
                            <mdb-btn outline="primary">Primary</mdb-btn>
                            <mdb-btn outline="default">Default</mdb-btn>
                            <mdb-btn outline="secondary">Secondary</mdb-btn>
                            <mdb-btn outline="success">Success</mdb-btn>
                            <mdb-btn outline="info">Info</mdb-btn>
                            <mdb-btn outline="warning">Warning</mdb-btn>
                            <mdb-btn outline="danger">Danger</mdb-btn>
                        </div>
                    </template>
                

                    <script>
                        import { mdbBtn } from 'mdbvue';
                        export default {
                            name: 'ButtonPage',
                            components: {
                                mdbBtn
                            }
                        } 
                    </script>
                

Rounded buttons MDB Pro component


                    <template>
                        <div>
                            <mdb-btn color="primary" rounded>Primary rounded button</mdb-btn>
                            <mdb-btn color="default" rounded>Default rounded button</mdb-btn>
                            <mdb-btn color="secondary" rounded>Secondary rounded button</mdb-btn>
                            <mdb-btn color="success" rounded>Success rounded button</mdb-btn>
                            <mdb-btn color="info" rounded>Info rounded button</mdb-btn>
                            <mdb-btn color="warning" rounded>Warning rounded button</mdb-btn>
                            <mdb-btn color="danger" rounded>Danger rounded button</mdb-btn>
                        </div>
                    </template>
                

                    <script>
                        import { mdbBtn } from 'mdbvue';
                        export default {
                            name: 'ButtonPage',
                            components: {
                                mdbBtn
                            }
                        } 
                    </script>
                

Rounded outline buttons MDB Pro component


                    <template>
                        <div>
                            <mdb-btn outline="primary" darkWaves rounded>Primary outline button</mdb-btn>
                            <mdb-btn outline="default" darkWaves rounded>Default outline button</mdb-btn>
                            <mdb-btn outline="secondary" darkWaves rounded>Secondary outline button</mdb-btn>
                            <mdb-btn outline="success" darkWaves rounded>Success outline button</mdb-btn>
                            <mdb-btn outline="info" darkWaves rounded>Info outline button</mdb-btn>
                            <mdb-btn outline="warning" darkWaves rounded>Warning outline button</mdb-btn>
                            <mdb-btn outline="danger" darkWaves rounded>Danger outline button</mdb-btn>
                        </div>
                    </template>
                

                    <script>
                        import { mdbBtn } from 'mdbvue';
                        export default {
                            name: 'ButtonPage',
                            components: {
                                mdbBtn
                            }
                        } 
                    </script>
                

Floating buttons MDB Pro component


                    <template>
                        <div>
                            <mdb-btn tag="a" gradient="purple" floating size="lg"><mdb-icon icon="bolt"/></mdb-btn>
                            <mdb-btn tag="a" gradient="peach" floating><mdb-gicon icon="leaf"/></mdb-btn>
                            <mdb-btn tag="a" gradient="blue" floating size="sm"><mdb-icon icon="star"/></mdb-btn>
                        </div>
                    </template>
                

                    <script>
                        import { mdbBtn } from 'mdbvue';
                        export default {
                            name: 'ButtonPage',
                            components: {
                                mdbBtn
                            }
                        } 
                    </script>
                

See the full list of available icons and colors for your buttons.


Fixed buttons MDB Pro component

See the live example of fixed button in the bottom right corner of this page.


                    <template>
                        <mdb-btn-fixed @mouseenter.native="hover" @mouseleave.native="hoverOut" icon="pencil" size="lg" :bottom="30" :right="25">
                            <mdb-btn-fixed-item :show="show" color="red" icon="star"/>
                            <mdb-btn-fixed-item :show="show" color="yellow" icon="user"/>
                            <mdb-btn-fixed-item :show="show" color="green" icon="envelope"/>
                            <mdb-btn-fixed-item :show="show" color="blue" icon="shopping-cart"/>
                        </mdb-btn-fixed>
                    </template>
                

                    <script>
                        import { mdbBtn, mdbBtnFixed, mdbBtnFixedItem } from 'mdbvue';
                        export default {
                            data() {
                                return {
                                    show: false
                                };
                            },
                            name: 'ButtonPage',
                            components: {
                                mdbBtn,
                                mdbBtnFixed,
                                mdbBtnFixedItem
                                },
                            methods: {
                                hover() {
                                    this.show = true;
                                },
                                hoverOut() {
                                    this.show = false;
                                }
                            }
                        }
                    </script>
                

"Back to the top" button

"Back to the top" button is very useful with the long pages, especially on the mobile devices.

Click the button below to see the live example.

Live example

                    <template>
                        <mdb-btn-fixed @click.native.prevent="pageUp" color="blue" icon="arrow-up" size="lg" :bottom="30" :right="105"/>
                    </template>
                

                    <script>
                        import { mdbBtnFixed } from 'mdbvue';
                        export default {
                            data() {
                                return {
                                    active: false
                                };
                            },
                            name: 'ButtonPage',
                            components: {
                                mdbBtnFixed
                            },
                            methods: {
                                pageUp() {
                                    window.scroll({top: 0, left: 0, behavior: 'smooth'});
                                }
                            }
                        };
                    </script>
                

Flat button MDB Pro component


                    <template>            
                        <mdb-btn flat size="lg" darkWaves>Click me</mdb-btn>
                    </template>
                

                    <script>
                        import { mdbBtn } from 'mdbvue';
                        export default {
                            name: 'ButtonPage',
                            components: {
                                mdbBtn
                            }
                        }
                    </script>
                

Buttons with icons

Note: To set the desired distance between icon and text use spacing utilities (for example .ml-1, .mr-2).


                    <template>
                        <div>
                            <mdb-btn color="primary"><mdb-icon icon="magic" class="mr-1"/> Left</mdb-btn>
                            <mdb-btn color="default">Right <mdb-icon icon="magic" class="ml-1"/></mdb-btn>
                        </div>
                    </template>
                

                    <script>
                        import { mdbBtn } from 'mdbvue';
                        export default {
                            name: 'ButtonPage',
                            components: {
                                mdbBtn
                            }
                        }
                    </script>
                

See the full list of available icons for your buttons.


Button tags

The .btn classes are designed to be used with the <button> element. However, you can also use these classes on <a> 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.

Link

                    <template>
                        <div>
                            <mdb-btn tag="a" role="button" color="primary" href="#">Link</mdb-btn>
                            <mdb-btn color="primary" type="submit">Button</mdb-btn>
                        </div>
                    </template>
                

                    <script>
                        import { mdbBtn } from 'mdbvue';
                        export default {
                            name: 'ButtonPage',
                            components: {
                                mdbBtn
                            }
                        }
                    </script>
                

Sizes

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


                    <template>
                        <div>
                            <mdb-btn size="lg" color="primary">Large button</mdb-btn>
                            <mdb-btn size="lg" color="default">Large button</mdb-btn>
                        </div>
                    <template>
                

                    <script>
                        import { mdbBtn } from 'mdbvue';
                        export default {
                            name: 'ButtonPage',
                            components: {
                                mdbBtn
                            }
                        }
                    </script>
                

                    <template>
                        <div>
                            <mdb-btn size="sm" color="primary">Small button</mdb-btn>
                            <mdb-btn size="sm" color="default">Small button</mdb-btn>
                        </div>
                    </template>
                

                    <script>
                        import { mdbBtn } from 'mdbvue';
                        export default {
                            name: 'ButtonPage',
                            components: {
                                mdbBtn
                            }
                        }
                    </script>
                

Create block level buttons—those that span the full width of a parent—by adding block.


                    <template>
                        <div>
                            <mdb-btn block color="default">Block level button</mdb-btn>
                            <mdb-btn block color="primary">Block level button</mdb-btn>
                        </div>
                    </template>
                

                    <script>
                        import { mdbBtn } from 'mdbvue';
                        export default {
                            name: 'ButtonPage',
                            components: {
                                mdbBtn
                            }
                        }
                    </script>
                

Button states

Active state

btns will appear pressed (with a darker background, darker border, and inset shadow) when active. There’s no need to add a class to <btn>s as they use a pseudo-class. However, you can still force the same active appearance with active should you need to replicate the state programmatically.

Link active

                    <template>
                        <div>
                            <mdb-btn active size="lg" color="primary">btn active</mdb-btn>
                            <mdb-btn tag="a" role="button" active size="lg" href="#">btn active</mdb-btn>
                        </div>
                    </template>
                

                    <script>
                        import { mdbBtn } from 'mdbvue';
                        export default {
                            name: 'ButtonPage',
                            components: {
                                mdbBtn
                            }
                        }
                    </script>
                

Disabled state

Make buttons look inactive by adding the disabled boolean attribute to any <btn> element.


                    <template>
                        <div>
                            <mdb-btn disabled size="lg" color="primary">Primary button</mdb-btn>
                            <mdb-btn disabled size="lg" color="default">Button</mdb-btn>
                        </div>
                    </template>
                

                    <script>
                        import { mdbBtn } from 'mdbvue';
                        export default {
                            name: 'ButtonPage',
                            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.


Button plugin

Do more with buttons. Control button states or create groups of buttons for more components like toolbars.

Toggle states


                    <template>
                        <mdb-btn color="primary" @click.native="toggleActiveState" :active="active">Single Toggle</mdb-btn> 
                    </template>
                

                    <script>
                        import { mdbBtn } from 'mdbvue';
                        export default {
                            data() {
                                return {
                                    active: false,
                                };
                            },
                            name: 'ButtonPage',
                            components: {
                                mdbBtn
                            },
                            methods: {
                                toggleActiveState() {
                                    this.active = !this.active;
                                }
                            }
                        }
                    </script>
                

Checkbox and radio buttons


                    <template>
                        <mdb-btn-group>
                            <mdb-btn color="primary" @click.native="toggleActiveState2" :active="active2">Checkbox 1 (pre-checked)</mdb-btn>
                            <mdb-btn color="primary" @click.native="toggleActiveState3" :active="active3">Checkbox 2</mdb-btn>
                            <mdb-btn color="primary" @click.native="toggleActiveState4" :active="active4">Checkbox 3</mdb-btn>
                        </mdb-btn-group>
                    </template>
                

                    <script>
                        import { mdbBtn, mdbBtnGroup } from 'mdbvue';
                        export default {
                            data() {
                                return {
                                    active2: true,
                                    active3: false,
                                    active4: false
                                };
                            },
                            name: 'ButtonPage',
                            components: {
                                mdbBtn,
                                mdbBtnGroup
                            },
                            methods: {
                                toggleActiveState2() {
                                    this.active2 = !this.active2;
                                },
                                toggleActiveState3() {
                                    this.active3 = !this.active3;
                                },
                                toggleActiveState4() {
                                    this.active4 = !this.active4;
                                }
                            }
                        }
                    </script>
                

                    <template>
                        <mdb-btn-group>
                            <mdb-btn color="primary" @click.native="toggleActiveState5" :active="active5">Radio 1 (preselected)</mdb-btn>
                            <mdb-btn color="primary" @click.native="toggleActiveState6" :active="active6">Radio 2</mdb-btn>
                            <mdb-btn color="primary" @click.native="toggleActiveState7" :active="active7">Radio 3</mdb-btn>
                        </mdb-btn-group>
                    </template>
                

                    <script>
                        import { mdbBtn, mdbBtnGroup } from 'mdbvue';
                        export default {
                            data() {
                                return {
                                    active5: true,
                                    active6: false,
                                    active7: false
                                };
                            },
                            name: 'ButtonPage',
                            components: {
                                mdbBtn,
                                mdbBtnGroup
                            },
                            methods: {
                                toggleActiveState5() {
                                    this.active5 = true;
                                    this.active6 = false;
                                    this.active7 = false;
                                },
                                toggleActiveState6() {
                                    this.active5 = false;
                                    this.active6 = true;
                                    this.active7 = false;
                                },
                                toggleActiveState7() {
                                    this.active5 = false;
                                    this.active6 = false;
                                    this.active7 = true;
                                }
                            }
                        }
                    </script>
                

Buttons - API

In this section you will find advanced information about the Buttons component. You will learn which modules are required in this component, what are the possibilities of configuring the component, and what events and methods you can use in working with it.


Import statement


import { mdbBtn, mdbBtnFixed, mdbBtnFixedItem, mdbBtnGroup, mdbIcon } from 'mdbvue';
      

API Reference: Properties

Name Type Default Description Example
tag String 'button' Changes button tag <mdb-btn tag="a">
color String 'default' Determines button color <mdb-btn color="primary">
outline String Changes button outline color <mdb-btn outline="primary">
text String Allows for easier button customization with regards to button text color and more. Simply add a color from our palette omitting the -text postfix - it will be added for you - and you are all set <mdb-btn color="primary" text="secondary">
size String Determines button size <mdb-btn size="lg">
block Boolean false Create block level buttons <mdb-btn block>
role String Adds role attribute to button <mdb-btn role="...">
type String Adds type attribute to button <mdb-btn type="...">
active Boolean false Adds active class <mdb-btn active>
disabled Boolean false Adds disabled class <mdb-btn disabled>
icon String Adds icon inside button <mdb-btn icon="user">
iconLeft Boolean false Determines the position of icon <mdb-btn iconLeft>
iconRight Boolean false Determines the position of icon <mdb-btn iconRight>
gradient String Adds gradient effect to button <mdb-btn gradient="peach">
rounded Boolean false Adds rounded effect to button <mdb-btn rounded>
floating Boolean false Adds floating effect to button <mdb-btn floating>
flat Boolean false Adds flat effect to button <mdb-btn flat>
transparent Boolean false Makes button transparent <mdb-btn transparent>
save Boolean false Usuful for save button inside select <mdb-btn save>
iconClass String Changes icon's element class inside button <mdb-btn iconClass="..." >
iconColor String Changes icon's element color <mdb-btn iconColor="..." >