Dropdowns
Vue Bootstrap 5 Dropdown component
Toggle contextual overlays for displaying lists of links and more with the MDB dropdown plugin.
Note: Read the API tab to find all available options and advanced customization
Basic examples
Wrap the MDBDropdownToggle
(your button or link) and the
MDBDropdownMenu
within MDBDropdown
element. Bind any
truthy
or falsy
ref value to MDBDropdownMenu
and toggle
dropdown with a MDBDropdownToggle
component. MDBDropdownMenu
use
semantic <ul>
elements where appropriate, but custom markup is supported.
Colors
You can do this with any button variant:
<template>
<!-- Primary -->
<MDBDropdown btnGroup v-model="dropdown3">
<MDBDropdownToggle @click="dropdown3 = !dropdown3">
Action
</MDBDropdownToggle>
<MDBDropdownMenu>
<MDBDropdownItem href="#">Action</MDBDropdownItem>
<MDBDropdownItem href="#">Another Action</MDBDropdownItem>
<MDBDropdownItem href="#">Something else here</MDBDropdownItem>
<MDBDropdownItem divider />
<MDBDropdownItem href="#">Separated link</MDBDropdownItem>
</MDBDropdownMenu>
</MDBDropdown>
<!-- Secondary -->
<MDBDropdown btnGroup v-model="dropdown4">
<MDBDropdownToggle
@click="dropdown4 = !dropdown4"
color="secondary"
>
Action
</MDBDropdownToggle>
<MDBDropdownMenu>
<MDBDropdownItem href="#">Action</MDBDropdownItem>
<MDBDropdownItem href="#">Another Action</MDBDropdownItem>
<MDBDropdownItem href="#">Something else here</MDBDropdownItem>
<MDBDropdownItem divider />
<MDBDropdownItem href="#">Separated link</MDBDropdownItem>
</MDBDropdownMenu>
</MDBDropdown>
<!-- Success -->
<MDBDropdown btnGroup v-model="dropdown5">
<MDBDropdownToggle
@click="dropdown5 = !dropdown5"
color="success"
>
Action
</MDBDropdownToggle>
<MDBDropdownMenu>
<MDBDropdownItem href="#">Action</MDBDropdownItem>
<MDBDropdownItem href="#">Another Action</MDBDropdownItem>
<MDBDropdownItem href="#">Something else here</MDBDropdownItem>
<MDBDropdownItem divider />
<MDBDropdownItem href="#">Separated link</MDBDropdownItem>
</MDBDropdownMenu>
</MDBDropdown>
<!-- Info -->
<MDBDropdown btnGroup v-model="dropdown6">
<MDBDropdownToggle @click="dropdown6 = !dropdown6" color="info">
Action
</MDBDropdownToggle>
<MDBDropdownMenu>
<MDBDropdownItem href="#">Action</MDBDropdownItem>
<MDBDropdownItem href="#">Another Action</MDBDropdownItem>
<MDBDropdownItem href="#">Something else here</MDBDropdownItem>
<MDBDropdownItem divider />
<MDBDropdownItem href="#">Separated link</MDBDropdownItem>
</MDBDropdownMenu>
</MDBDropdown>
<!-- Warning -->
<MDBDropdown btnGroup v-model="dropdown7">
<MDBDropdownToggle
@click="dropdown7 = !dropdown7"
color="warning"
>
Action
</MDBDropdownToggle>
<MDBDropdownMenu>
<MDBDropdownItem href="#">Action</MDBDropdownItem>
<MDBDropdownItem href="#">Another Action</MDBDropdownItem>
<MDBDropdownItem href="#">Something else here</MDBDropdownItem>
<MDBDropdownItem divider />
<MDBDropdownItem href="#">Separated link</MDBDropdownItem>
</MDBDropdownMenu>
</MDBDropdown>
<!-- Danger -->
<MDBDropdown btnGroup v-model="dropdown8">
<MDBDropdownToggle @click="dropdown8 = !dropdown8" color="danger">
Action
</MDBDropdownToggle>
<MDBDropdownMenu>
<MDBDropdownItem href="#">Action</MDBDropdownItem>
<MDBDropdownItem href="#">Another Action</MDBDropdownItem>
<MDBDropdownItem href="#">Something else here</MDBDropdownItem>
<MDBDropdownItem divider />
<MDBDropdownItem href="#">Separated link</MDBDropdownItem>
</MDBDropdownMenu>
</MDBDropdown>
<!-- Dark -->
<MDBDropdown btnGroup v-model="dropdown9">
<MDBDropdownToggle @click="dropdown9 = !dropdown9" color="dark">
Action
</MDBDropdownToggle>
<MDBDropdownMenu>
<MDBDropdownItem href="#">Action</MDBDropdownItem>
<MDBDropdownItem href="#">Another Action</MDBDropdownItem>
<MDBDropdownItem href="#">Something else here</MDBDropdownItem>
<MDBDropdownItem divider />
<MDBDropdownItem href="#">Separated link</MDBDropdownItem>
</MDBDropdownMenu>
</MDBDropdown>
<!-- Light -->
<MDBDropdown btnGroup v-model="dropdown10">
<MDBDropdownToggle
@click="dropdown10 = !dropdown10"
color="light"
>
Action
</MDBDropdownToggle>
<MDBDropdownMenu>
<MDBDropdownItem href="#">Action</MDBDropdownItem>
<MDBDropdownItem href="#">Another Action</MDBDropdownItem>
<MDBDropdownItem href="#">Something else here</MDBDropdownItem>
<MDBDropdownItem divider />
<MDBDropdownItem href="#">Separated link</MDBDropdownItem>
</MDBDropdownMenu>
</MDBDropdown>
<!-- Link -->
<MDBDropdown btnGroup v-model="dropdown11">
<MDBDropdownToggle @click="dropdown11 = !dropdown11" color="link">
Action
</MDBDropdownToggle>
<MDBDropdownMenu>
<MDBDropdownItem href="#">Action</MDBDropdownItem>
<MDBDropdownItem href="#">Another Action</MDBDropdownItem>
<MDBDropdownItem href="#">Something else here</MDBDropdownItem>
<MDBDropdownItem divider />
<MDBDropdownItem href="#">Separated link</MDBDropdownItem>
</MDBDropdownMenu>
</MDBDropdown>
</template>
<script>
import { MDBDropdown, MDBDropdownToggle, MDBDropdownMenu, MDBDropdownItem } from "mdb-vue-ui-kit";
import { ref } from 'vue';
export default {
components: {
MDBDropdown,
MDBDropdownToggle,
MDBDropdownMenu,
MDBDropdownItem
},
setup() {
const dropdown3 = ref(false);
const dropdown4 = ref(false);
const dropdown5 = ref(false);
const dropdown6 = ref(false);
const dropdown7 = ref(false);
const dropdown8 = ref(false);
const dropdown9 = ref(false);
const dropdown10 = ref(false);
const dropdown11 = ref(false);
const dropdown12 = ref(false);
return {
dropdown3,
dropdown4,
dropdown5,
dropdown6,
dropdown7,
dropdown8,
dropdown9,
dropdown10,
dropdown11,
dropdown12
}
}
};
</script>
Sizing
MDBDropdownToggle
work with all button sizes, including default and split
dropdown buttons.
<template>
<div>
<!-- Large button groups (default and split) -->
<MDBDropdown btnGroup v-model="dropdown13">
<MDBDropdownToggle size="lg" @click="dropdown13 = !dropdown13">
Large button
</MDBDropdownToggle>
<MDBDropdownMenu>
<MDBDropdownItem href="#">Action</MDBDropdownItem>
<MDBDropdownItem href="#">Another Action</MDBDropdownItem>
<MDBDropdownItem href="#">Something else here</MDBDropdownItem>
<MDBDropdownItem divider />
<MDBDropdownItem href="#">Separated link</MDBDropdownItem>
</MDBDropdownMenu>
</MDBDropdown>
<MDBDropdown btnGroup v-model="dropdown14">
<MDBBtn color="primary">Large split button</MDBBtn>
<MDBDropdownToggle
split
size="lg"
@click="dropdown14 = !dropdown14"
/>
<MDBDropdownMenu>
<MDBDropdownItem href="#">Action</MDBDropdownItem>
<MDBDropdownItem href="#">Another Action</MDBDropdownItem>
<MDBDropdownItem href="#">Something else here</MDBDropdownItem>
<MDBDropdownItem divider />
<MDBDropdownItem href="#">Separated link</MDBDropdownItem>
</MDBDropdownMenu>
</MDBDropdown>
<!-- Small button groups (default and split) -->
<MDBDropdown btnGroup v-model="dropdown15">
<MDBDropdownToggle size="sm" @click="dropdown15 = !dropdown15">
Small button
</MDBDropdownToggle>
<MDBDropdownMenu>
<MDBDropdownItem href="#">Action</MDBDropdownItem>
<MDBDropdownItem href="#">Another Action</MDBDropdownItem>
<MDBDropdownItem href="#">Something else here</MDBDropdownItem>
<MDBDropdownItem divider />
<MDBDropdownItem href="#">Separated link</MDBDropdownItem>
</MDBDropdownMenu>
</MDBDropdown>
<MDBDropdown btnGroup v-model="dropdown16">
<MDBBtn color="primary" size="sm">Small split button</MDBBtn>
<MDBDropdownToggle
split
size="sm"
@click="dropdown16 = !dropdown16"
/>
<MDBDropdownMenu>
<MDBDropdownItem href="#">Action</MDBDropdownItem>
<MDBDropdownItem href="#">Another Action</MDBDropdownItem>
<MDBDropdownItem href="#">Something else here</MDBDropdownItem>
<MDBDropdownItem divider />
<MDBDropdownItem href="#">Separated link</MDBDropdownItem>
</MDBDropdownMenu>
</MDBDropdown>
</div>
</template>
<script>
import { MDBDropdown, MDBDropdownToggle, MDBDropdownMenu, MDBDropdownItem, MDBBtn } from "mdb-vue-ui-kit";
import { ref } from 'vue';
export default {
components: {
MDBDropdown,
MDBDropdownToggle,
MDBDropdownMenu,
MDBDropdownItem,
MDBBtn
},
setup() {
const dropdown13 = ref(false);
const dropdown14 = ref(false);
const dropdown15 = ref(false);
const dropdown16 = ref(false);
return {
dropdown13,
dropdown14,
dropdown15,
dropdown16
}
}
};
</script>
Directions
Dropup
Trigger dropdown menus above elements by adding
dropup
property to the MDBDropdown
component.
<template>
<!-- Default dropup button -->
<MDBDropdown btnGroup dropup v-model="dropdown17">
<MDBDropdownToggle @click="dropdown17 = !dropdown17">
Dropup
</MDBDropdownToggle>
<MDBDropdownMenu>
<MDBDropdownItem href="#">Action</MDBDropdownItem>
<MDBDropdownItem href="#">Another Action</MDBDropdownItem>
<MDBDropdownItem href="#">Something else here</MDBDropdownItem>
<MDBDropdownItem divider />
<MDBDropdownItem href="#">Separated link</MDBDropdownItem>
</MDBDropdownMenu>
</MDBDropdown>
<!-- Split dropup button -->
<MDBDropdown btnGroup dropup v-model="dropdown18">
<MDBBtn color="primary">Split dropup</MDBBtn>
<MDBDropdownToggle split @click="dropdown18 = !dropdown18" />
<MDBDropdownMenu>
<MDBDropdownItem href="#">Action</MDBDropdownItem>
<MDBDropdownItem href="#">Another Action</MDBDropdownItem>
<MDBDropdownItem href="#">Something else here</MDBDropdownItem>
<MDBDropdownItem divider />
<MDBDropdownItem href="#">Separated link</MDBDropdownItem>
</MDBDropdownMenu>
</MDBDropdown>
</template>
<script>
import { MDBDropdown, MDBDropdownToggle, MDBDropdownMenu, MDBDropdownItem, MDBBtn } from "mdb-vue-ui-kit";
import { ref } from 'vue';
export default {
components: {
MDBDropdown,
MDBDropdownToggle,
MDBDropdownMenu,
MDBDropdownItem,
MDBBtn
},
setup() {
const dropdown17 = ref(false);
const dropdown18 = ref(false);
return {
dropdown17,
dropdown18
}
}
};
</script>
Dropright
Trigger dropdown menus at the right of the elements by adding
.dropend
to the parent element.
<template>
<!-- Default dropend button -->
<MDBDropdown btnGroup dropend v-model="dropdown19">
<MDBDropdownToggle @click="dropdown19 = !dropdown19">
Dropend
</MDBDropdownToggle>
<MDBDropdownMenu>
<MDBDropdownItem href="#">Action</MDBDropdownItem>
<MDBDropdownItem href="#">Another Action</MDBDropdownItem>
<MDBDropdownItem href="#">Something else here</MDBDropdownItem>
<MDBDropdownItem divider />
<MDBDropdownItem href="#">Separated link</MDBDropdownItem>
</MDBDropdownMenu>
</MDBDropdown>
<!-- Split dropend button -->
<MDBDropdown btnGroup dropend v-model="dropdown20">
<MDBBtn color="primary">Split dropend</MDBBtn>
<MDBDropdownToggle split @click="dropdown20 = !dropdown20" />
<MDBDropdownMenu>
<MDBDropdownItem href="#">Action</MDBDropdownItem>
<MDBDropdownItem href="#">Another Action</MDBDropdownItem>
<MDBDropdownItem href="#">Something else here</MDBDropdownItem>
<MDBDropdownItem divider />
<MDBDropdownItem href="#">Separated link</MDBDropdownItem>
</MDBDropdownMenu>
</MDBDropdown>
</template>
<script>
import { MDBDropdown, MDBDropdownToggle, MDBDropdownMenu, MDBDropdownItem, MDBBtn } from "mdb-vue-ui-kit";
import { ref } from 'vue';
export default {
components: {
MDBDropdown,
MDBDropdownToggle,
MDBDropdownMenu,
MDBDropdownItem,
MDBBtn
},
setup() {
const dropdown19 = ref(false);
const dropdown20 = ref(false);
return {
dropdown19,
dropdown20
}
}
};
</script>
Dropleft
Trigger dropdown menus at the left of the elements by adding
dropstart
> property to the MDBDropdown
> component.
<template>
<!-- Default dropstart button -->
<MDBDropdown btnGroup dropstart v-model="dropdown21">
<MDBDropdownToggle @click="dropdown21 = !dropdown21">
Dropstart
</MDBDropdownToggle>
<MDBDropdownMenu>
<MDBDropdownItem href="#">Action</MDBDropdownItem>
<MDBDropdownItem href="#">Another Action</MDBDropdownItem>
<MDBDropdownItem href="#">Something else here</MDBDropdownItem>
<MDBDropdownItem divider />
<MDBDropdownItem href="#">Separated link</MDBDropdownItem>
</MDBDropdownMenu>
</MDBDropdown>
<!-- Split dropstart button -->
<div class="btn-group">
<MDBDropdown btnGroup dropstart v-model="dropdown22">
<MDBDropdownToggle split @click="dropdown22 = !dropdown22" />
<MDBDropdownMenu>
<MDBDropdownItem href="#">Action</MDBDropdownItem>
<MDBDropdownItem href="#">Another Action</MDBDropdownItem>
<MDBDropdownItem href="#">Something else here</MDBDropdownItem>
<MDBDropdownItem divider />
<MDBDropdownItem href="#">Separated link</MDBDropdownItem>
</MDBDropdownMenu>
</MDBDropdown>
<MDBBtn color="primary">Split dropstart</MDBBtn>
</div>
</template>
<script>
import { MDBDropdown, MDBDropdownToggle, MDBDropdownMenu, MDBDropdownItem, MDBBtn } from "mdb-vue-ui-kit";
import { ref } from 'vue';
export default {
components: {
MDBDropdown,
MDBDropdownToggle,
MDBDropdownMenu,
MDBDropdownItem,
MDBBtn
},
setup() {
const dropdown21 = ref(false);
const dropdown22 = ref(false);
return {
dropdown21,
dropdown22
}
}
};
</script>
Remove animation
To remove the fade animation on click, add
:animation="false"
attribute to the MDBDRopdownToggle
.
<template>
<MDBDropdown v-model="dropdown28">
<MDBDropdownToggle
@click="dropdown28 = !dropdown28"
id="dropdownExampleAnimation"
>
Dropdown button
</MDBDropdownToggle>
<MDBDropdownMenu :animation="false">
<MDBDropdownItem href="#">Action</MDBDropdownItem>
<MDBDropdownItem href="#">Another Action</MDBDropdownItem>
<MDBDropdownItem href="#">Something else here</MDBDropdownItem>
</MDBDropdownMenu>
</MDBDropdown>
</template>
<script>
import { MDBDropdown, MDBDropdownToggle, MDBDropdownMenu, MDBDropdownItem } from "mdb-vue-ui-kit";
import { ref } from 'vue';
export default {
components: {
MDBDropdown,
MDBDropdownToggle,
MDBDropdownMenu,
MDBDropdownItem
},
setup() {
const dropdown28 = ref(false);
return {
dropdown28
}
}
};
</script>
Dropdown options
To change the offset of the dropdown menu add
offset="skiddingValue, distanceValue"
property. To change the location of the
dropdown menu add target
property with value of selector to expected reference
for dropdown.
<template>
<div class="d-flex">
<MDBDropdown offset="10,20" class="me-1" v-model="dropdown29">
<MDBDropdownToggle @click="dropdown29 = !dropdown29">
Offset
</MDBDropdownToggle>
<MDBDropdownMenu>
<MDBDropdownItem href="#">Action</MDBDropdownItem>
<MDBDropdownItem href="#">Another action</MDBDropdownItem>
<MDBDropdownItem href="#">Something else here</MDBDropdownItem>
<MDBDropdownItem divider />
<MDBDropdownItem href="#">Separated list</MDBDropdownItem>
</MDBDropdownMenu>
</MDBDropdown>
<MDBDropdown
btnGroup
id="referenceTarget"
target="#referenceTarget"
v-model="dropdown30"
>
<MDBBtn color="primary">Reference</MDBBtn>
<MDBDropdownToggle split @click="dropdown30 = !dropdown30">
<span class="visually-hidden">Toggle Dropdown</span>
</MDBDropdownToggle>
<MDBDropdownMenu>
<MDBDropdownItem href="#">Action</MDBDropdownItem>
<MDBDropdownItem href="#">Another action</MDBDropdownItem>
<MDBDropdownItem href="#">Something else here</MDBDropdownItem>
<MDBDropdownItem divider />
<MDBDropdownItem href="#">Separated list</MDBDropdownItem>
</MDBDropdownMenu>
</MDBDropdown>
</div>
</template>
<script>
import { MDBDropdown, MDBDropdownToggle, MDBDropdownMenu, MDBDropdownItem } from "mdb-vue-ui-kit";
import { ref } from 'vue';
export default {
components: {
MDBDropdown,
MDBDropdownToggle,
MDBDropdownMenu,
MDBDropdownItem
},
setup() {
const dropdown29 = ref(false);
const dropdown30 = ref(false);
return {
dropdown29,
dropdown30,
}
}
};
</script>
Dark variant
Add dark
property onto an existing MDBDropdownMenu
to match a dark
navbar.
<template>
<MDBDropdown v-model="dropdown31">
<MDBDropdownToggle
@click="dropdown31 = !dropdown31"
id="dropdownExampleAnimation"
>
Dropdown button
</MDBDropdownToggle>
<MDBDropdownMenu dark>
<MDBDropdownItem href="#">Action</MDBDropdownItem>
<MDBDropdownItem href="#">Another Action</MDBDropdownItem>
<MDBDropdownItem href="#">Something else here</MDBDropdownItem>
<MDBDropdownItem divider />
<MDBDropdownItem href="#">Separated link</MDBDropdownItem>
</MDBDropdownMenu>
</MDBDropdown>
</template>
<script>
import { MDBDropdown, MDBDropdownToggle, MDBDropdownMenu, MDBDropdownItem } from "mdb-vue-ui-kit";
import { ref } from 'vue';
export default {
components: {
MDBDropdown,
MDBDropdownToggle,
MDBDropdownMenu,
MDBDropdownItem
},
setup() {
const dropdown31 = ref(false);
return {
dropdown31
}
}
};
</script>
Dropdowns - API
Import
<script>
import {
MDBDropdown,
MDBDropdownToggle,
MDBDropdownMenu,
MDBDropdownItem
} from 'mdb-vue-ui-kit';
</script>
Properties
MDBDropdown
Name | Type | Default | Description | Example |
---|---|---|---|---|
tag
|
String | 'div' |
Defines tag of the MDBDropdown element |
<MDBDropdown tag="section" />
|
v-model
|
Boolean |
|
Toggle MDBDropdown component open and closed |
<MDBDropdown tag="true" />
|
btnGroup
|
Boolean | false |
Changes alignment of the toggler to fit within a button gro |
<MDBDropdown btnGroup />
|
dropup
|
Boolean | false |
Trigger dropdown menus above elements |
<MDBDropdown dropup />
|
dropend
|
Boolean | false |
Trigger dropdown menus at the right of the elements |
<MDBDropdown dropend />
|
dropstart
|
Boolean | false |
Trigger dropdown menus at the left of the elements |
<MDBDropdown dropstart />
|
align
|
String | Array | 'start' |
Aligns dropdown menu along the left or rigth side of the parent |
<MDBDropdown align="end" />
|
offset |
String |
|
Offset of the dropdown menu relative to its parent. |
<MDBDropdown offset="0, 10" />
|
target |
String |
|
Sets custom selector for dropdown menu reference target |
<MDBPopover target="#reference-target" />
|
MDBDropdownToggle
Name | Type | Default | Description | Example |
---|---|---|---|---|
tag
|
String | 'button' |
Defines tag of the MDBDropdownToggle element |
<MDBDropdownToggle tag="div" />
|
color
|
String | 'primary |
Sets color of the MDBDropdownToggle element |
<MDBDropdownToggle color="secondary" />
|
href
|
String |
|
Sets href attribute if tag is set to a |
<MDBDropdownToggle tag="a" href="#" />
|
split
|
Boolean | false |
Allows to create split buttons |
<MDBBtn color="primary">Split</MDBBtn>
<MDBDropdownToggle split />
|
MDBDropdownMenu
Name | Type | Default | Description | Example |
---|---|---|---|---|
tag
|
String | 'ul' |
Defines tag of the MDBDropdownMenu element |
<MDBDropdownMenu tag="div" />
|
animation
|
Boolean | true |
Toggle animation on dropdown menu on or off |
<MDBDropdownMenu :animation="false" />
|
dark
|
Boolean | false |
Sets MDBDropdownMenu element color to dark |
<MDBDropdownMenu dark />
|
MDBDropdownItem
Name | Type | Default | Description | Example |
---|---|---|---|---|
tag
|
String | 'a' |
Defines tag of the MDBDropdownItem element |
<MDBDropdownItem tag="div" />
|
to
|
String | Object |
|
Changes the component's tag to router-link |
<MDBDropdownItem to="/" />
|
href
|
String |
|
The href attribute's value of the anchor tag |
<MDBDropdownItem href="/" />
|
disabled
|
Boolean | false |
Disables the item |
<MDBDropdownItem disabled />
|
active
|
Boolean | false |
Adds active class to the item |
<MDBDropdownItem active />
|
exact
|
Boolean | false |
Sets exact attribute of the component |
<MDBDropdownItem to="/" exact />
|
newTab
|
Boolean | false |
Sets component's target to "_blank" |
<MDBDropdownItem href="/" newTab />
|
divider
|
Boolean | false |
Sets element as a divider |
<MDBDropdownItem divider />
|
text
|
Boolean | false |
Sets element as a text element |
<MDBDropdownItem text />
|
header
|
Boolean | false |
Sets element as a header element |
<MDBDropdownItem header ag="h6" />
|