Bootstrap Home

Dropdowns

Basic Dropdown

Context Buttons

Any button variant, too.


Dropdown Divider

The .dropdown-divider class is used to separate links inside the dropdown menu with a thin horizontal line.


Dropdown Header

The .dropdown-header class is used to add headers inside the dropdown menu.


Disable and Active Items

The .active class adds a blue background color to the active link.

The .disabled class disables a dropdown item (grey text color).


Directions

Dropright

Add the .dropend class next to the dropdown menu to right-align the dropdown. Note that the caret/arrow is added automatically.


Dropleft

Add the .dropstart class next to the dropdown menu to left-align the dropdown. Note that the caret/arrow is added automatically. Also note that we float the dropdown to the right.


Dropup

The .dropup class makes the dropdown menu expand upwards instead of downwards.


Dropdown Menu Right

Add the .dropdown-menu-end class to .dropdown-menu to right-align the dropdown menu.


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.


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 Text

The .dropdown-item-text class is used to add plain text to a dropdown, or used on links for default link styling.


Grouped Buttons With A Dropdown

Nest button groups to create dropdown menus.


Vertical Button Group With Dropdown

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.


Sizing

Button dropdowns work with buttons of all sizes, including default and split dropdown buttons.


Dark Dropdowns

Opt into darker dropdowns to match a dark navbar or custom style by adding .dropdown-menu-dark onto an existing .dropdown-menu.



And putting it to use in a navbar.