Dropdowns

Toggle contextual overlays for displaying lists of links and more with the Bootstrap dropdown plugin.

Overview

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.

Dropdowns are built on a third party library, Popper.js, which provides dynamic positioning and viewport detection. Be sure to include popper.min.js before Bootstrap’s JavaScript or use bootstrap.bundle.min.js / bootstrap.bundle.js which contains Popper.js. Popper.js isn’t used to position dropdowns in navbars though as dynamic positioning isn’t required.

If you’re building our JavaScript from source, it requires util.js.

Examples

Wrap the dropdown’s toggle (your button or link) and the dropdown menu within .dropdown, or another element that declares position: relative;. Dropdowns can be triggered from <a> or <button></button> elements to better fit your potential needs.

                            
                              <div class="dropdown">
                                <a id="dropdownPosition" class="btn btn-primary dropdown-toggle" href="#" aria-haspopup="true" aria-expanded="false"
                                   data-toggle="dropdown">
                                  <span class="align-middle">Dropdown Variation</span>
                                  <i class="nova-angle-down icon-text icon-text-xs align-middle ml-3"></i>
                                </a>

                                <div class="dropdown-menu" aria-labelledby="dropdownPosition">
                                  <a class="dropdown-item" href="#">Training taxes</a>
                                  <a class="dropdown-item" href="#">Shipping</a>
                                  <a class="dropdown-item" href="#">Outsourcing</a>
                                  <a class="dropdown-item disabled" href="#">Consulting</a>
                                  <div class="dropdown-divider"></div>
                                  <a class="dropdown-item" href="#">Office supplies</a>
                                </div>
                              </div>
                            
                          

Sizes

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

                            
                              <div class="dropdown">
                                <a id="dropdownPosition2" class="btn btn-primary btn-lg dropdown-toggle" href="#" aria-haspopup="true" aria-expanded="false"
                                   data-toggle="dropdown">
                                  <span class="align-middle">Large button</span>
                                  <i class="nova-angle-down icon-text icon-text-xs align-middle ml-3"></i>
                                </a>

                                <div class="dropdown-menu" aria-labelledby="dropdownPosition2">
                                  <a class="dropdown-item" href="#">Training taxes</a>
                                  <a class="dropdown-item" href="#">Shipping</a>
                                  <a class="dropdown-item" href="#">Outsourcing</a>
                                  <a class="dropdown-item disabled" href="#">Consulting</a>
                                  <div class="dropdown-divider"></div>
                                  <a class="dropdown-item" href="#">Office supplies</a>
                                </div>
                              </div>

                              <div class="dropdown">
                                <a id="dropdownSizeMd" class="btn btn-primary dropdown-toggle" href="#" aria-haspopup="true" aria-expanded="false"
                                   data-toggle="dropdown">
                                  <span class="align-middle">Medium button</span>
                                  <i class="nova-angle-down icon-text icon-text-xs align-middle ml-3"></i>
                                </a>

                                <div class="dropdown-menu" aria-labelledby="dropdownSizeMd">
                                  <a class="dropdown-item" href="#">Training taxes</a>
                                  <a class="dropdown-item" href="#">Shipping</a>
                                  <a class="dropdown-item" href="#">Outsourcing</a>
                                  <a class="dropdown-item disabled" href="#">Consulting</a>
                                  <div class="dropdown-divider"></div>
                                  <a class="dropdown-item" href="#">Office supplies</a>
                                </div>
                              </div>

                              <div class="dropdown">
                                <a id="dropdownSizeSm" class="btn btn-primary btn-sm dropdown-toggle" href="#" aria-haspopup="true" aria-expanded="false"
                                   data-toggle="dropdown">
                                  <span class="align-middle">Small button</span>
                                  <i class="nova-angle-down icon-text icon-text-xs align-middle ml-3"></i>
                                </a>

                                <div class="dropdown-menu" aria-labelledby="dropdownSizeSm">
                                  <a class="dropdown-item" href="#">Training taxes</a>
                                  <a class="dropdown-item" href="#">Shipping</a>
                                  <a class="dropdown-item" href="#">Outsourcing</a>
                                  <a class="dropdown-item disabled" href="#">Consulting</a>
                                  <div class="dropdown-divider"></div>
                                  <a class="dropdown-item" href="#">Office supplies</a>
                                </div>
                              </div>
                            
                          

Accessibility

Nova’s dropdowns, on the other hand, are designed to be generic and applicable to a variety of situations and markup structures. For instance, it is possible to create dropdowns that contain additional inputs and form controls, such as search fields or login forms. For this reason, Bootstrap does not expect (nor automatically add) any of the role and aria- attributes required for true ARIA menus. Authors will have to include these more specific attributes themselves.

However, Bootstrap does add built-in support for most standard keyboard menu interactions, such as the ability to move through individual .dropdown-item elements using the cursor keys and close the menu with the ESC key.