![]() |
VOOZH | about |
Bootstrap 5 is the latest major release by Bootstrap in which they have revamped the UI and made various changes. Dropdowns are toggleable, contextual overlays for displaying lists of links and more. They’re made interactive with the included Bootstrap dropdown JavaScript plugin. They’re toggled by clicking, not by hovering; this is an intentional design decision.
Syntax:
<div class="dropdown"> Contents... <div>Example 1: This example shows the working of a dropdown with button in Bootstrap 5.
Output:
Dropdown Divider: The .dropdown-divider class is used to divide the dropdown menu list by using a thin horizontal line. This example shows the working of collapsible cards in Bootstrap 5.
Output:
Dropdown Header: The .dropdown-header class is used to add header section inside the dropdown list.
Output:
Disable and Active items: The .active class is used to add the highlight the list items. The .disabled class is used to disable the list items.
Output:
Dropdown Position: The .dropright and .dropleft classes are used to set the position of the dropdown menu in the left and right sides.
Example 1:
Output:
Example 2:
Output:
Dropdown Menu Right Aligned: The .dropdown-menu-right class is used to set the right-align of the dropdown menu.
Output:
Dropup: The .dropup class is used instead of .dropdown class to expand the menu list in upwards direction.
Output:
Dropdown Text: The .dropdown-item-text class adds plain text to the dropdown menu list.
Output:
Grouped Buttons with a Dropdown: The .btn-group class is used to create a group of buttons and the .dropdown-menu class is used to create a dropdown list.
Output:
Split Button Dropdowns: The .dropdown-toggle-split class is used to split the dropdown buttons.
Output:
Vertical Button Group Dropdown List: The .btn-group-vertical class is used to create vertical button group with the dropdown list.
Output:
Reference:https://getbootstrap.com/docs/5.2/components/dropdowns/