Components
Dropdowns
Contextual menus on a native details element, or on a popover with light-dismiss and anchor positioning.
How it works
Two mechanisms share the same .dropdown-menu styles. Pick per use.
-
<details class="dropdown">— the summary is the toggle, the.dropdown-menufollows it. Universal. The menu stays open until the summary is clicked again; there is no click-outside dismissal. -
Popover — a
<button popovertarget>and a<ul class="dropdown-menu" popover>. Light-dismiss and Escape. With CSS anchor positioning the menu hangs off the button; without it the menu rises as a bottom sheet.
- Baseline:
<details>(everywhere); Popover API (Chrome 114, Safari 17, Firefox 125). - Enhancement: anchor positioning (
position-area,position-try-fallbacks) for the popover variant — the menu flips to stay on screen. - Fallback: the popover variant becomes a full-width bottom sheet. The static
.dropdown-menu.showclass still renders an open menu.
data-bs-toggle="dropdown", data-bs-auto-close, data-bs-offset and
data-bs-reference are inert. Popper is not loaded.Single button
The summary takes any button classes. Bootstrap's caret comes from .dropdown-toggle.
Dropdown button
HTML
<details class="dropdown">
<summary class="btn btn-secondary dropdown-toggle">Dropdown button</summary>
<ul class="dropdown-menu">
<li><a class="dropdown-item" href="#!">Action</a></li>
<li><a class="dropdown-item" href="#!">Another action</a></li>
<li><a class="dropdown-item" href="#!">Something else here</a></li>
</ul>
</details>Works with every variant, including the brand colours.
Primary
Success
Danger
Gold
Navy
Cream
HTML
<details class="dropdown">
<summary class="btn btn-primary dropdown-toggle">Primary</summary>
<ul class="dropdown-menu">
<li><a class="dropdown-item" href="#!">Action</a></li>
<li><a class="dropdown-item" href="#!">Another action</a></li>
<li><hr class="dropdown-divider"></li>
<li><a class="dropdown-item" href="#!">Separated link</a></li>
</ul>
</details>
<details class="dropdown">
<summary class="btn btn-success dropdown-toggle">Success</summary>
<ul class="dropdown-menu">
<li><a class="dropdown-item" href="#!">Action</a></li>
<li><a class="dropdown-item" href="#!">Another action</a></li>
</ul>
</details>
<details class="dropdown">
<summary class="btn btn-danger dropdown-toggle">Danger</summary>
<ul class="dropdown-menu">
<li><a class="dropdown-item" href="#!">Action</a></li>
<li><a class="dropdown-item" href="#!">Another action</a></li>
</ul>
</details>
<details class="dropdown">
<summary class="btn btn-gold dropdown-toggle">Gold</summary>
<ul class="dropdown-menu">
<li><a class="dropdown-item" href="#!">Action</a></li>
<li><a class="dropdown-item" href="#!">Another action</a></li>
</ul>
</details>
<details class="dropdown">
<summary class="btn btn-navy dropdown-toggle">Navy</summary>
<ul class="dropdown-menu">
<li><a class="dropdown-item" href="#!">Action</a></li>
<li><a class="dropdown-item" href="#!">Another action</a></li>
</ul>
</details>
<details class="dropdown">
<summary class="btn btn-cream dropdown-toggle">Cream</summary>
<ul class="dropdown-menu">
<li><a class="dropdown-item" href="#!">Action</a></li>
<li><a class="dropdown-item" href="#!">Another action</a></li>
</ul>
</details>Split button
Wrap the action button and a <details class="dropdown btn-group"> in an outer
.btn-group. The summary gets .dropdown-toggle-split for the narrower padding and a
visually hidden label.
Toggle dropdown
Toggle dropdown
Toggle dropdown
HTML
<div class="btn-group">
<button type="button" class="btn btn-primary">Action</button>
<details class="dropdown btn-group">
<summary class="btn btn-primary dropdown-toggle dropdown-toggle-split"><span class="visually-hidden">Toggle dropdown</span></summary>
<ul class="dropdown-menu">
<li><a class="dropdown-item" href="#!">Action</a></li>
<li><a class="dropdown-item" href="#!">Another action</a></li>
<li><a class="dropdown-item" href="#!">Something else here</a></li>
<li><hr class="dropdown-divider"></li>
<li><a class="dropdown-item" href="#!">Separated link</a></li>
</ul>
</details>
</div>
<div class="btn-group">
<button type="button" class="btn btn-navy">Action</button>
<details class="dropdown btn-group">
<summary class="btn btn-navy dropdown-toggle dropdown-toggle-split"><span class="visually-hidden">Toggle dropdown</span></summary>
<ul class="dropdown-menu">
<li><a class="dropdown-item" href="#!">Action</a></li>
<li><a class="dropdown-item" href="#!">Another action</a></li>
</ul>
</details>
</div>
<div class="btn-group">
<button type="button" class="btn btn-outline-secondary">Action</button>
<details class="dropdown btn-group">
<summary class="btn btn-outline-secondary dropdown-toggle dropdown-toggle-split"><span class="visually-hidden">Toggle dropdown</span></summary>
<ul class="dropdown-menu">
<li><a class="dropdown-item" href="#!">Action</a></li>
<li><a class="dropdown-item" href="#!">Another action</a></li>
</ul>
</details>
</div>Sizing
Size the summary with .btn-lg or .btn-sm.
Large button
Toggle dropdown
HTML
<details class="dropdown">
<summary class="btn btn-secondary btn-lg dropdown-toggle">Large button</summary>
<ul class="dropdown-menu">
<li><a class="dropdown-item" href="#!">Action</a></li>
<li><a class="dropdown-item" href="#!">Another action</a></li>
</ul>
</details>
<div class="btn-group">
<button type="button" class="btn btn-secondary btn-lg">Large split button</button>
<details class="dropdown btn-group">
<summary class="btn btn-secondary btn-lg dropdown-toggle dropdown-toggle-split"><span class="visually-hidden">Toggle dropdown</span></summary>
<ul class="dropdown-menu">
<li><a class="dropdown-item" href="#!">Action</a></li>
<li><a class="dropdown-item" href="#!">Another action</a></li>
</ul>
</details>
</div>Small button
Toggle dropdown
HTML
<details class="dropdown">
<summary class="btn btn-secondary btn-sm dropdown-toggle">Small button</summary>
<ul class="dropdown-menu">
<li><a class="dropdown-item" href="#!">Action</a></li>
<li><a class="dropdown-item" href="#!">Another action</a></li>
</ul>
</details>
<div class="btn-group">
<button type="button" class="btn btn-secondary btn-sm">Small split button</button>
<details class="dropdown btn-group">
<summary class="btn btn-secondary btn-sm dropdown-toggle dropdown-toggle-split"><span class="visually-hidden">Toggle dropdown</span></summary>
<ul class="dropdown-menu">
<li><a class="dropdown-item" href="#!">Action</a></li>
<li><a class="dropdown-item" href="#!">Another action</a></li>
</ul>
</details>
</div>Dark dropdowns
Add data-bs-theme="dark" to the <details> or the menu. The legacy
.dropdown-menu-dark class is still compiled but deprecated in Bootstrap 5.3.
Dropdown button
HTML
<details class="dropdown" data-bs-theme="dark">
<summary class="btn btn-secondary dropdown-toggle">Dropdown button</summary>
<ul class="dropdown-menu">
<li><a class="dropdown-item active" href="#!">Action</a></li>
<li><a class="dropdown-item" href="#!">Another action</a></li>
<li><a class="dropdown-item" href="#!">Something else here</a></li>
<li><hr class="dropdown-divider"></li>
<li><a class="dropdown-item" href="#!">Separated link</a></li>
</ul>
</details>Directions
Change the class on the <details>. The caret on .dropdown-toggle follows.
Centered
Centered dropdown
HTML
<details class="dropdown-center">
<summary class="btn btn-secondary dropdown-toggle">Centered dropdown</summary>
<ul class="dropdown-menu">
<li><a class="dropdown-item" href="#!">Action</a></li>
<li><a class="dropdown-item" href="#!">Action two</a></li>
<li><a class="dropdown-item" href="#!">Action three</a></li>
</ul>
</details>Dropup
Dropup
Toggle dropup
HTML
<details class="dropup">
<summary class="btn btn-secondary dropdown-toggle">Dropup</summary>
<ul class="dropdown-menu">
<li><a class="dropdown-item" href="#!">Action</a></li>
<li><a class="dropdown-item" href="#!">Another action</a></li>
<li><a class="dropdown-item" href="#!">Something else here</a></li>
</ul>
</details>
<div class="btn-group dropup">
<button type="button" class="btn btn-secondary">Split dropup</button>
<details class="dropup btn-group">
<summary class="btn btn-secondary dropdown-toggle dropdown-toggle-split"><span class="visually-hidden">Toggle dropup</span></summary>
<ul class="dropdown-menu">
<li><a class="dropdown-item" href="#!">Action</a></li>
<li><a class="dropdown-item" href="#!">Another action</a></li>
</ul>
</details>
</div>Dropup centered
Centered dropup
HTML
<details class="dropup-center">
<summary class="btn btn-secondary dropdown-toggle">Centered dropup</summary>
<ul class="dropdown-menu">
<li><a class="dropdown-item" href="#!">Action</a></li>
<li><a class="dropdown-item" href="#!">Action two</a></li>
<li><a class="dropdown-item" href="#!">Action three</a></li>
</ul>
</details>Dropend
Dropend
HTML
<details class="dropend">
<summary class="btn btn-secondary dropdown-toggle">Dropend</summary>
<ul class="dropdown-menu">
<li><a class="dropdown-item" href="#!">Action</a></li>
<li><a class="dropdown-item" href="#!">Another action</a></li>
<li><a class="dropdown-item" href="#!">Something else here</a></li>
</ul>
</details>Dropstart
Dropstart
HTML
<details class="dropstart">
<summary class="btn btn-secondary dropdown-toggle">Dropstart</summary>
<ul class="dropdown-menu">
<li><a class="dropdown-item" href="#!">Action</a></li>
<li><a class="dropdown-item" href="#!">Another action</a></li>
<li><a class="dropdown-item" href="#!">Something else here</a></li>
</ul>
</details>Menu items
Items can be links or buttons. Mark the current one with .active and aria-current="true"; disable with .disabled and aria-disabled="true". The active fill is gold with navy text.
Menu items
HTML
<details class="dropdown">
<summary class="btn btn-secondary dropdown-toggle">Menu items</summary>
<ul class="dropdown-menu">
<li><a class="dropdown-item" href="#!">Regular link</a></li>
<li><a class="dropdown-item active" href="#!" aria-current="true">Active link</a></li>
<li><button class="dropdown-item" type="button">A button item</button></li>
<li><a class="dropdown-item disabled" aria-disabled="true">Disabled link</a></li>
</ul>
</details>Menu alignment
By default the menu aligns to the left edge of the toggle. Add .dropdown-menu-end to the menu to align it right.
Right-aligned menu
HTML
<details class="dropdown">
<summary class="btn btn-secondary dropdown-toggle">Right-aligned menu</summary>
<ul class="dropdown-menu dropdown-menu-end">
<li><a class="dropdown-item" href="#!">Action</a></li>
<li><a class="dropdown-item" href="#!">Another action</a></li>
<li><a class="dropdown-item" href="#!">Something else here</a></li>
</ul>
</details>Responsive alignment
.dropdown-menu{-sm|-md|-lg|-xl|-xxl}-end and -start switch alignment at a
breakpoint. Combine them: start by default, end from lg up.
Left-aligned but right-aligned when large screen
Right-aligned but left-aligned when large screen
HTML
<details class="dropdown">
<summary class="btn btn-secondary dropdown-toggle">Left-aligned but right-aligned when large screen</summary>
<ul class="dropdown-menu dropdown-menu-lg-end">
<li><a class="dropdown-item" href="#!">Action</a></li>
<li><a class="dropdown-item" href="#!">Another action</a></li>
</ul>
</details>
<details class="dropdown">
<summary class="btn btn-secondary dropdown-toggle">Right-aligned but left-aligned when large screen</summary>
<ul class="dropdown-menu dropdown-menu-end dropdown-menu-lg-start">
<li><a class="dropdown-item" href="#!">Action</a></li>
<li><a class="dropdown-item" href="#!">Another action</a></li>
</ul>
</details>Menu content
Headers
With header
HTML
<details class="dropdown">
<summary class="btn btn-secondary dropdown-toggle">With header</summary>
<ul class="dropdown-menu">
<li><h6 class="dropdown-header">Dropdown header</h6></li>
<li><a class="dropdown-item" href="#!">Action</a></li>
<li><a class="dropdown-item" href="#!">Another action</a></li>
</ul>
</details>Dividers
With divider
HTML
<details class="dropdown">
<summary class="btn btn-secondary dropdown-toggle">With divider</summary>
<ul class="dropdown-menu">
<li><a class="dropdown-item" href="#!">Action</a></li>
<li><a class="dropdown-item" href="#!">Another action</a></li>
<li><a class="dropdown-item" href="#!">Something else here</a></li>
<li><hr class="dropdown-divider"></li>
<li><a class="dropdown-item" href="#!">Separated link</a></li>
</ul>
</details>Text
Free-form text with .dropdown-item-text, or any content with spacing utilities.
With text
HTML
<details class="dropdown">
<summary class="btn btn-secondary dropdown-toggle">With text</summary>
<div class="dropdown-menu p-4 text-body-secondary" style="max-width: 200px;">
<p>Some example text that is free-flowing within the dropdown menu.</p>
<p class="mb-0">And this is more example text.</p>
</div>
</details>Forms
Put a form in the menu. A <details> menu is the better host for a form, since it will not light-dismiss while the user types.
Sign in
HTML
<details class="dropdown">
<summary class="btn btn-secondary dropdown-toggle">Sign in</summary>
<div class="dropdown-menu">
<form class="px-4 py-3">
<div class="mb-3">
<label for="dropdowns-form-email" class="form-label">Email address</label>
<input type="email" class="form-control" id="dropdowns-form-email" placeholder="[email protected]">
</div>
<div class="mb-3">
<label for="dropdowns-form-password" class="form-label">Password</label>
<input type="password" class="form-control" id="dropdowns-form-password" placeholder="Password">
</div>
<div class="mb-3">
<div class="form-check">
<input type="checkbox" class="form-check-input" id="dropdowns-form-remember">
<label class="form-check-label" for="dropdowns-form-remember">Remember me</label>
</div>
</div>
<button type="submit" class="btn btn-primary">Sign in</button>
</form>
<div class="dropdown-divider"></div>
<a class="dropdown-item" href="#!">New around here? Sign up</a>
<a class="dropdown-item" href="#!">Forgot password?</a>
</div>
</details>Popover dropdowns
For click-outside and Escape dismissal, use the Popover API. The wrapper is a plain .dropdown;
the button carries popovertarget; the menu carries popover and the matching
id. The menu renders in the top layer, so it is never clipped by an overflow
ancestor — useful inside cards and tables.
HTML
<div class="dropdown">
<button type="button" class="btn btn-secondary dropdown-toggle" popovertarget="dropdowns-pop-1">Popover menu</button>
<ul class="dropdown-menu" popover id="dropdowns-pop-1">
<li><a class="dropdown-item" href="#!">Action</a></li>
<li><a class="dropdown-item" href="#!">Another action</a></li>
<li><a class="dropdown-item" href="#!">Something else here</a></li>
<li><hr class="dropdown-divider"></li>
<li><a class="dropdown-item" href="#!">Separated link</a></li>
</ul>
</div>Directions and alignment use the same classes on the wrapper and the menu.
HTML
<div class="dropup d-inline-block">
<button type="button" class="btn btn-secondary dropdown-toggle" popovertarget="dropdowns-pop-up">Popover dropup</button>
<ul class="dropdown-menu" popover id="dropdowns-pop-up">
<li><a class="dropdown-item" href="#!">Action</a></li>
<li><a class="dropdown-item" href="#!">Another action</a></li>
</ul>
</div>
<div class="dropend d-inline-block">
<button type="button" class="btn btn-secondary dropdown-toggle" popovertarget="dropdowns-pop-end">Popover dropend</button>
<ul class="dropdown-menu" popover id="dropdowns-pop-end">
<li><a class="dropdown-item" href="#!">Action</a></li>
<li><a class="dropdown-item" href="#!">Another action</a></li>
</ul>
</div>
<div class="dropdown d-inline-block">
<button type="button" class="btn btn-secondary dropdown-toggle" popovertarget="dropdowns-pop-endalign">Right-aligned</button>
<ul class="dropdown-menu dropdown-menu-end" popover id="dropdowns-pop-endalign">
<li><a class="dropdown-item" href="#!">Action</a></li>
<li><a class="dropdown-item" href="#!">Another action</a></li>
</ul>
</div>
<div class="dropdown-center d-inline-block">
<button type="button" class="btn btn-secondary dropdown-toggle" popovertarget="dropdowns-pop-center">Centered</button>
<ul class="dropdown-menu" popover id="dropdowns-pop-center">
<li><a class="dropdown-item" href="#!">Action</a></li>
<li><a class="dropdown-item" href="#!">Another action</a></li>
</ul>
</div>Auto close behavior
Bootstrap's data-bs-auto-close options map to the two mechanisms:
| Bootstrap option | Use |
|---|---|
true (close on inside or outside click) | Popover variant. Items that are links navigate; items that are buttons leave the menu open — add popovertarget + popovertargetaction="hide" to a button item to close on click. |
outside | Popover variant with button items (no extra attributes). |
inside | Not available. |
false (manual) | <details> variant. |
Accessibility
- The
<summary>and thepopovertargetbutton are native toggles. Engines expose the expanded state; do not addaria-expandedyourself. - The menu is a list of links. There is no arrow-key navigation between items (that was a plugin feature); Tab moves through them in order.
- The popover variant closes on Escape and returns focus to the button.
- Split-button toggles need a
.visually-hiddenlabel; the caret has no text. - In the navbar, a
<details class="dropdown">can act as a.nav-itemwith a<summary class="nav-link">.
CSS
All of Bootstrap's --bs-dropdown-* variables apply.
.dropdown-menu {
--bs-dropdown-zindex: 100; // token z-dropdown
--bs-dropdown-min-width: 10rem;
--bs-dropdown-spacer: 0.125rem;
--bs-dropdown-border-radius: 2px; // $dropdown-border-radius: $border-radius-sm
--bs-dropdown-box-shadow: var(--bs-box-shadow);
--bs-dropdown-link-hover-bg: var(--bs-tertiary-bg);
--bs-dropdown-link-active-color: #0a1b3d; // navy-900
--bs-dropdown-link-active-bg: #b8941f; // gold-700; gold-500 in dark mode
--bs-dropdown-header-color: #4a6398; // navy-400
}
The rules from scss/components/_dropdown.scss:
details[open] > .dropdown-menu // shown
details > .dropdown-menu // static placement below the summary
details.dropup / .dropend / .dropstart // placement variants
details.dropdown-center / .dropup-center // translateX(-50%)
details > .dropdown-menu{-bp}-end / -start // alignment
.btn-group > details.dropdown // inline-flex, for split buttons and nesting
.dropdown-menu[popover]:popover-open // top-layer menu
position-area: bottom span-right // anchored (progressive), with flip fallbacks
inset: auto 0 0 0; width: 100% // bottom sheet when anchors are unsupported