agyanadda@gmail.com

Bootstrap Dropdowns

Bootstrap Components 1 min read Updated Dec 1, 2026 Topic 18 of 32

A dropdown shows a list of options when a button is clicked.

Structure

<div class="dropdown">
  <button class="btn btn-primary dropdown-toggle" data-bs-toggle="dropdown">Menu</button>
  <ul class="dropdown-menu">
    <li><a class="dropdown-item" href="#">Item</a></li>
  </ul>
</div>

Extras

  • dropdown-header — a small title inside the menu
  • <hr class="dropdown-divider"> — separator line
  • active / disabled on a dropdown-item
  • dropdown-menu-end — align the menu to the right
  • Direction: dropup, dropend, dropstart
  • Split button: a normal button + a dropdown-toggle-split button in a btn-group
  • Dark menu: dropdown-menu-dark

Dropdowns need the bundle JS file (it includes Popper for positioning).

Example

Example — Dropdown and split button HTML
<link href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.3/dist/css/bootstrap.min.css" rel="stylesheet">

<div class="container my-3 d-flex gap-3" style="min-height: 220px;">
  <div class="dropdown">
    <button class="btn btn-primary dropdown-toggle" type="button" data-bs-toggle="dropdown">My Account</button>
    <ul class="dropdown-menu">
      <li><h6 class="dropdown-header">Asha Kumari</h6></li>
      <li><a class="dropdown-item" href="#">Profile</a></li>
      <li><a class="dropdown-item active" href="#">My Courses</a></li>
      <li><a class="dropdown-item disabled" href="#">Certificates (soon)</a></li>
      <li><hr class="dropdown-divider"></li>
      <li><a class="dropdown-item text-danger" href="#">Logout</a></li>
    </ul>
  </div>

  <div class="btn-group">
    <button type="button" class="btn btn-success">Download</button>
    <button type="button" class="btn btn-success dropdown-toggle dropdown-toggle-split" data-bs-toggle="dropdown"></button>
    <ul class="dropdown-menu dropdown-menu-end">
      <li><a class="dropdown-item" href="#">PDF</a></li>
      <li><a class="dropdown-item" href="#">Excel</a></li>
    </ul>
  </div>
</div>

<script src="https://cdn.jsdelivr.net/npm/bootstrap@5.3.3/dist/js/bootstrap.bundle.min.js"></script>

Test Yourself With Exercises

Exercise 1 Multiple Choice

Which attribute opens a dropdown on click?

Exercise 2 True / False

dropdown-menu-end aligns the menu to the right edge of the button.

Exercise 3 Fill in the Blank

Use <hr class="dropdown-___"> to add a line between items.

Frequently Asked Questions

You probably loaded bootstrap.min.js without Popper. Use bootstrap.bundle.min.js, which includes Popper.