Dropdown Menus
Use a dropdown menu to present a contextual list of links without taking up permanent page space. This reference includes a basic menu example, the required markup, and options for alignment, disabled items, and nested menus.
For an interactive dropdown, use the dropdown JavaScript plugin.
Basic dropdown menu example
This example shows a standard dropdown menu with links and a divider.
Menu markup
<ul class="dropdown-menu" role="menu" aria-labelledby="dropdownMenu">
<li><a tabindex="-1" href="#">Action</a></li>
<li><a tabindex="-1" href="#">Another action</a></li>
<li><a tabindex="-1" href="#">Something else here</a></li>
<li class="divider"></li>
<li><a tabindex="-1" href="#">Separated link</a></li>
</ul>
Required dropdown structure
Wrap the dropdown trigger and menu in a .dropdown container, or another element that uses position: relative;. Then add the menu inside that container.
<div class="dropdown">
<!-- Link or button to toggle dropdown -->
<ul class="dropdown-menu" role="menu" aria-labelledby="dLabel">
<li><a tabindex="-1" href="#">Action</a></li>
<li><a tabindex="-1" href="#">Another action</a></li>
<li><a tabindex="-1" href="#">Something else here</a></li>
<li class="divider"></li>
<li><a tabindex="-1" href="#">Separated link</a></li>
</ul>
</div>
Dropdown menu options
Right-align a menu
Add .pull-right to the .dropdown-menu element.
<ul class="dropdown-menu pull-right" role="menu" aria-labelledby="dLabel">
...
</ul>
Show a disabled menu item
Add .disabled to the relevant <li> element.
<ul class="dropdown-menu" role="menu" aria-labelledby="dropdownMenu">
<li><a tabindex="-1" href="#">Regular link</a></li>
<li class="disabled"><a tabindex="-1" href="#">Disabled link</a></li>
<li><a tabindex="-1" href="#">Another link</a></li>
</ul>
Nested dropdown menus
To add another menu level, apply .dropdown-submenu to an item in an existing dropdown menu and nest a second .dropdown-menu inside it.
<ul class="dropdown-menu" role="menu" aria-labelledby="dLabel">
...
<li class="dropdown-submenu">
<a tabindex="-1" href="#">More options</a>
<ul class="dropdown-menu">
...
</ul>
</li>
</ul>
For a left-opening submenu, add .pull-left to the .dropdown-submenu item. A .dropup container can be used when the menu should open upward.
Dropdown menu FAQs
What is required to make a dropdown interactive?
Use the dropdown JavaScript plugin to make the menu interactive.
How do I align a dropdown menu to the right?
Add the .pull-right class to the .dropdown-menu element.
How do I disable an item in a dropdown menu?
Add the .disabled class to that menu item’s <li> element.