Rate this docs

Vue Bootstrap Dropdowns

Vue Dropdowns - Bootstrap 4 & Material Design

Vue Bootstrap dropdown is a toggleable menu embedding additional links or content. It allows you to construct advanced navigation and link categorization.

In case of more complicated navigations systems dropdowns are the essential elements providing you with possibility of placing all the most relevant links in our navigation bar (or other component acting as navigation - such as SideNav)

Aside from being not only highly functional, MDB dropdowns are also extraordinary visually attractive. It gives them this characteristic Material Design effects, like shadows, living colors or charming waves effect after opening a link.

They’re toggled by clicking, not by hovering; this is an intentional design decision. Why?

MDB is "mobile first" framework so, we avoid mixing functional elements and interaction by hovering because it decreases User Experience of users of mobile devices.

Google Material Design guidelines recommend the same approach.


Basic example


        <mdb-dropdown>
          <mdb-dropdown-toggle slot="toggle">Basic dropdown</mdb-dropdown-toggle>
          <mdb-dropdown-menu>
            <mdb-dropdown-item>Action</mdb-dropdown-item>
            <mdb-dropdown-item>Another action</mdb-dropdown-item>
            <mdb-dropdown-item>Something else here</mdb-dropdown-item>
            <div class="dropdown-divider"></div>
            <mdb-dropdown-item>Separated link</mdb-dropdown-item>
          </mdb-dropdown-menu>
        </mdb-dropdown>
      

Material dropdowns MDB Pro component


          <mdb-dropdown>
            <mdb-dropdown-toggle color="primary" slot="toggle">Material dropdown</mdb-dropdown-toggle>
            <mdb-dropdown-menu color="primary">
              <mdb-dropdown-item>Action</mdb-dropdown-item>
              <mdb-dropdown-item>Another action</mdb-dropdown-item>
              <mdb-dropdown-item>Something else here</mdb-dropdown-item>
              <div class="dropdown-divider"></div>
              <mdb-dropdown-item>Separated link</mdb-dropdown-item>
            </mdb-dropdown-menu>
          </mdb-dropdown>
        

To change a color of the dropdown use one of the following props.

  • primary

  • default

  • secondary

  • success

  • elegant

  • danger

  • info

  • warning

  • ins


Sizing

Button dropdowns work with buttons of all sizes


        <mdb-dropdown>
          <mdb-dropdown-toggle slot="toggle" color="danger" size="lg">Large button</mdb-dropdown-toggle>
          <mdb-dropdown-menu>
            <mdb-dropdown-item>Action</mdb-dropdown-item>
            <mdb-dropdown-item>Another action</mdb-dropdown-item>
            <mdb-dropdown-item>Something else here</mdb-dropdown-item>
            <div class="dropdown-divider"></div>
            <mdb-dropdown-item>Separated link</mdb-dropdown-item>
          </mdb-dropdown-menu>
        </mdb-dropdown>
        <mdb-dropdown>
          <mdb-dropdown-toggle slot="toggle" color="danger" size="sm">Small button</mdb-dropdown-toggle>
          <mdb-dropdown-menu>
            <mdb-dropdown-item>Action</mdb-dropdown-item>
            <mdb-dropdown-item>Another action</mdb-dropdown-item>
            <mdb-dropdown-item>Something else here</mdb-dropdown-item>
            <div class="dropdown-divider"></div>
            <mdb-dropdown-item>Separated link</mdb-dropdown-item>
          </mdb-dropdown-menu>
        </mdb-dropdown>
      

Dropup variation

Trigger dropdown menus above elements by adding dropup prop to the parent.


        <mdb-dropdown dropup>
          <mdb-dropdown-toggle slot="toggle" color="primary">Dropup</mdb-dropdown-toggle>
          <mdb-dropdown-menu dropup>
            <mdb-dropdown-item>Action</mdb-dropdown-item>
            <mdb-dropdown-item>Another action</mdb-dropdown-item>
            <mdb-dropdown-item>Something else here</mdb-dropdown-item>
            <div class="dropdown-divider"></div>
            <mdb-dropdown-item>Separated link</mdb-dropdown-item>
          </mdb-dropdown-menu>
        </mdb-dropdown>
      

Alignment

By default, a dropdown menu is automatically positioned 100% from the top and along the left side of its parent. Add right prop to a mdb-dropdown-menu component to right align the dropdown menu.


        <mdb-dropdown>
          <mdb-dropdown-toggle slot="toggle" color="primary">This dropdown's menu is right-aligned</mdb-dropdown-toggle>
          <mdb-dropdown-menu right>
            <mdb-dropdown-item>Action</mdb-dropdown-item>
            <mdb-dropdown-item>Another action</mdb-dropdown-item>
            <mdb-dropdown-item>Something else here</mdb-dropdown-item>
            <div class="dropdown-divider"></div>
            <mdb-dropdown-item>Separated link</mdb-dropdown-item>
          </mdb-dropdown-menu>
        </mdb-dropdown>
      



Disabled menu items

Add .disabled to items in the dropdown to style them as disabled.


        <mdb-dropdown>
          <mdb-dropdown-toggle slot="toggle" color="primary">Dropdown</mdb-dropdown-toggle>
          <mdb-dropdown-menu>
            <mdb-dropdown-item>Regular link</mdb-dropdown-item>
            <mdb-dropdown-item class="disabled">Disabled link</mdb-dropdown-item>
            <mdb-dropdown-item>Another link</mdb-dropdown-item>
          </mdb-dropdown-menu>
        </mdb-dropdown>
      

Active menu items

Add active to items in the dropdown to style them as active.


          <mdb-dropdown>
            <mdb-dropdown-toggle slot="toggle" color="primary">Dropdown</mdb-dropdown-toggle>
            <mdb-dropdown-menu>
              <mdb-dropdown-item>Action</mdb-dropdown-item>
              <mdb-dropdown-item active>Another action</mdb-dropdown-item>
              <mdb-dropdown-item>Something else here</mdb-dropdown-item>
              <div class="dropdown-divider"></div>
              <mdb-dropdown-item>Separated link</mdb-dropdown-item>
            </mdb-dropdown-menu>
          </mdb-dropdown>
        

Dropright variation

Trigger dropdown menus at the right of the elements by adding dropright to the parent element.


        <mdb-btn color="danger" class="m-0">Dropright</mdb-btn>
        <mdb-dropdown btn-group split dropright>
          <mdb-dropdown-toggle slot="toggle" color="danger" class="px-3"></mdb-dropdown-toggle>
          <mdb-dropdown-menu dropright>
            <mdb-dropdown-item>Action</mdb-dropdown-item>
            <mdb-dropdown-item>Another action</mdb-dropdown-item>
            <mdb-dropdown-item>Something else here</mdb-dropdown-item>
            <div class="dropdown-divider"></div>
            <mdb-dropdown-item>Separated link</mdb-dropdown-item>
          </mdb-dropdown-menu>
        </mdb-dropdown>
      

Dropleft variation

Trigger dropdown menus at the right of the elements by adding dropleft to the parent element.


          <mdb-dropdown btn-group dropleft style="padding-left: 200px">
            <mdb-dropdown-toggle slot="toggle" color="danger" class="px-3"></mdb-dropdown-toggle>
            <mdb-dropdown-menu dropleft>
              <mdb-dropdown-item>Action</mdb-dropdown-item>
              <mdb-dropdown-item>Another action</mdb-dropdown-item>
              <mdb-dropdown-item>Something else here</mdb-dropdown-item>
              <div class="dropdown-divider"></div>
              <mdb-dropdown-item>Separated link</mdb-dropdown-item>
            </mdb-dropdown-menu>
          </mdb-dropdown>
          <mdb-btn color="danger" style="margin-left: -5px">Dropleft</mdb-btn>
        

Dropdowns - API

In this section you will find advanced information about the Dropdowns 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 { mdbDropdown, mdbDropdownToggle, mdbDropdownMenu, mdbDropdownItem } from 'mdbvue';
      

API Reference: Properties

Name Type Default Description Example
tag String 'div' Changes dropdown's wrapper tag <mdb-dropdown tag="p" />
dropup Boolean false Trigger dropdown menus above elements <mdb-dropdown dropup />
dropright Boolean false Trigger dropdown menus at the right of the elements <mdb-dropdown dropright />
dropleft Boolean false Trigger dropdown menus at the left of the elements <mdb-dropdown dropleft />
megaMenu Boolean false Make dropdown act like a mega menu <mdb-dropdown megaMenu />