Dropdown
Set Theme Color
Icon Border Stroke
Layout Section Light/Dark
More App Settings
Dropdowns
Toggle contextual overlays for displaying lists of links and more with the Bootstrap dropdown plugin.
Any single .btn can be turned into a dropdown toggle with some
markup changes. Here’s how you can put them to work with either
<button> elements:
<div class="dropdown">
<button class="btn btn-primary dropdown-toggle" type="button" data-bs-toggle="dropdown" aria-expanded="false">
Primary Dropdown
</button>
<ul class="dropdown-menu border-0 shadow p-3">
<li><a class="dropdown-item py-2 rounded" href="#">Action</a></li>
<li><a class="dropdown-item py-2 rounded" href="#">Another action</a></li>
<li><a class="dropdown-item py-2 rounded" href="#">Something else here</a></li>
</ul>
</div>
The best part is you can do this with any button variant, too:
Sizing
Button dropdowns work with buttons of all sizes, including default and split dropdown buttons.
Split button
Similarly, create split button dropdowns with virtually the same
markup as single button dropdowns, but with the addition of
.dropdown-toggle-split for proper spacing around
the dropdown caret.
We use this extra class to reduce the horizontal
padding on either side of the caret by 25% and
remove the margin-left that’s added for regular
button dropdowns. Those extra changes keep the caret centered in
the split button and provide a more appropriately sized hit area
next to the main button.
Alignment options
Taking most of the options shown above, here’s a small kitchen sink demo of various dropdown alignment options in one place.
Dropdown options
Use data-bs-offset or data-bs-reference to
change the location of the dropdown.
Auto close behavior
By default, the dropdown menu is closed when clicking inside or
outside the dropdown menu. You can use the autoClose
option to change this behavior of the dropdown.
Responsive alignment
If you want to use responsive alignment, disable dynamic positioning
by adding the data-bs-display="static" attribute and
use the responsive variation classes.
To align right the dropdown menu with the given
breakpoint or larger, add
.dropdown-menu{-sm|-md|-lg|-xl|-xxl}-end.