VOOZH about

URL: https://www.geeksforgeeks.org/bootstrap/bootstrap-5-dropdowns-single-button/

⇱ Bootstrap 5 Dropdowns Single Button - GeeksforGeeks


  • Courses
  • Tutorials
  • Interview Prep

Bootstrap 5 Dropdowns Single Button

Last Updated : 24 Jul, 2024

Bootstrap 5 Dropdowns Single button is used to turn a button into a dropdown toggle with some basic markup. A dropdown button lets the user select from a number of items. 

Bootstrap 5 Dropdowns Single Button class:

  • dropdown-toggle: This class is used to make the button drop down.

Syntax:

<div class="dropdown">
<button class="btn dropdown-toggle" type="button"
id="gfg" data-bs-toggle="dropdown">
...
</button>
<ul class="dropdown-menu" aria-labelledby="gfg">
...
</ul>
</div>

Example 1: In this example, we set a button using .btn class and button turned into a dropdown toggle.

Output:

Example 2:  In this example, we set buttons using .btn class and the button turned into a dropdown toggle. Using dropdown-menu class, a list of items is shown on one click.

Output:

Reference: https://getbootstrap.com/docs/5.0/components/dropdowns/#single-button

Comment

Explore