Dropdowns are toggleable, contextual overlays for displaying lists of links and more. They’re made interactive with the included Bootstrap dropdown javascript plugin. Read the Official Bootstrap Documentationfor a full list of instructions and other options.
Wrap the dropdown’s toggle (your button or link) and the dropdown menu within .dropdown
, or another element that declares position relative. Dropdowns can be triggered from link or button elements to better fit your potential needs.
<div class="dropdown"> <button class="btn btn-secondary dropdown-toggle" type="button" id="dropdownMenuButton" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false"> Dropdown Menu </button> <div class="dropdown-menu" aria-labelledby="dropdownMenuButton"> <a class="dropdown-item" href="#">Action</a> <a class="dropdown-item" href="#">Another action</a> <a class="dropdown-item" href="#">Something else here</a> </div></div>
Trigger dropdown menus above elements by adding dropup class to the parent element.
<div class="dropdown dropup"> <button class="btn btn-secondary dropdown-toggle" type="button" id="dropupMenuButton" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false"> Dropup Menu </button> <div class="dropdown-menu" aria-labelledby="dropupMenuButton"> ... </div></div>
Trigger dropdown menus above elements by adding dropright class to the parent element.
<div class="dropdown dropright"> <button class="btn btn-secondary dropdown-toggle" type="button" id="droprightMenuButton" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false"> Dropright Menu </button> <div class="dropdown-menu" aria-labelledby="droprightMenuButton"> ... </div></div>
Trigger dropdown menus above elements by adding dropleft class to the parent element.
<div class="dropdown dropright"> <button class="btn btn-secondary dropdown-toggle" type="button" id="dropleftMenuButton" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false"> Dropleft Menu </button> <div class="dropdown-menu" aria-labelledby="dropleftMenuButton"> ... </div></div>
Add active class to items in the dropdown to style them as active.
<div class="dropdown-menu"> <a class="dropdown-item" href="#">Action</a> <a class="dropdown-item active" href="#">Another action</a> <a class="dropdown-item" href="#">Something else here</a></div>
Add disabled class to items in the dropdown to style them as disabled.
<div class="dropdown-menu"> <a class="dropdown-item" href="#">Action</a> <a class="dropdown-item disabled" href="#">Another action</a> <a class="dropdown-item" href="#">Something else here</a></div>
Add a header to label sections of actions in any dropdown menu.
<div class="dropdown-menu"> <h6 class="dropdown-header tx-uppercase tx-12 tx-bold tx-inverse">Dropdown header</h6> <a class="dropdown-item" href="#">Action</a> <a class="dropdown-item" href="#">Another action</a> <a class="dropdown-item" href="#">Something else here</a></div>
Separate groups of related menu items with a divider.
<div class="dropdown-menu"> <h6 class="dropdown-header tx-uppercase tx-12 tx-bold tx-inverse">Dropdown header</h6> <a class="dropdown-item" href="#">Action</a> <a class="dropdown-item" href="#">Another action</a> <a class="dropdown-item" href="#">Something else here</a> <div class="dropdown-divider"></div> <a class="dropdown-item" href="#">Separated link</a></div>
Place any freeform text within a dropdown menu with text and use spacing utilities. Note that you’ll likely need additional sizing styles to constrain the menu width.
<div class="dropdown-menu"> <div class="wd-200 pd-15"> <p>Some example text that's free-flowing within the dropdown menu.</p> <p class="mb-0">And this is more example text.</p> </div></div>
Put a form within a dropdown menu, or make it into a dropdown menu, and use margin or padding utilities to give it the negative space you require.
<div class="dropdown-menu"> <form class="wd-250 pd-15" action=""> ... </form></div>