Dropdown
A complete menu system – directions, submenus, sizes and a burger menu – built on <details> with zero JavaScript.
Description
A <details class="dropdown"> with a <summary class="btn"> trigger (usually with a chevron icon) and a <ul> menu. The menu floats below the trigger with panel elevation; its items are links, buttons or nested dropdown summaries. Utility classes control direction and alignment: .dropup, .dropright and .dropdown-align-right. An <hr> separates groups and class="active" highlights the current item.
Because everything is sized in em, applying .sm or .lg to the root of the dropdown resizes the whole menu. And wrapping the list in a <nav> or <div> deliberately cancels the item styling – that is how the burger menu variant keeps its links styled by the nav module instead.
The outside-click dismissal is a full-viewport invisible overlay behind the summary, so every menu closes without JavaScript. Keyboard and screen-reader behaviour are native to <details>, and submenus nest to any depth with the same markup.
Colors derive from the primary and panel tokens; radius and elevation come from _config.scss. The burger lines use contrast-color($color-primary), so they stay visible on colored headers. Size the whole menu with .sm/.lg at the root, or style the summary as any button variant.
Basic dropdown
Drop down
<details class="dropdown">
<summary class="btn">
Drop down
<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" fill="currentColor" viewBox="0 0 16 16"><path fill-rule="evenodd" d="M1.646 4.646a.5.5 0 0 1 .708 0L8 10.293l5.646-5.647a.5.5 0 0 1 .708.708l-6 6a.5.5 0 0 1-.708 0l-6-6a.5.5 0 0 1 0-.708"/></svg>
</summary>
<ul>
<li><a href="#">Action</a></li>
<li><a href="#">Another action</a></li>
<li><a href="#">Something else here</a></li>
</ul>
</details>Directions and alignment
<div class="flex-row" style="align-items: center">
<details class="dropdown dropup">
<summary class="btn">
Drop up
<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" fill="currentColor" viewBox="0 0 16 16"><path fill-rule="evenodd" d="M7.646 4.646a.5.5 0 0 1 .708 0l6 6a.5.5 0 0 1-.708.708L8 5.707l-5.646 5.647a.5.5 0 0 1-.708-.708z"/></svg>
</summary>
<ul>
<li><a href="#">Action</a></li>
<li><a href="#">Another action</a></li>
<li><a href="#">Super large text longer than the button</a></li>
</ul>
</details>
<details class="dropdown dropdown-align-right">
<summary class="btn">
Aligned right
<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" fill="currentColor" viewBox="0 0 16 16"><path fill-rule="evenodd" d="M1.646 4.646a.5.5 0 0 1 .708 0L8 10.293l5.646-5.647a.5.5 0 0 1 .708.708l-6 6a.5.5 0 0 1-.708 0l-6-6a.5.5 0 0 1 0-.708"/></svg>
</summary>
<ul>
<li><a href="#">Action</a></li>
<li><a href="#">Another action</a></li>
<li><a href="#">Super large text longer than the button</a></li>
</ul>
</details>
<details class="dropdown dropup dropdown-align-right">
<summary class="btn btn-round" aria-label="Open menu"><svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" fill="currentColor" viewBox="0 0 16 16"><path d="M9.5 13a1.5 1.5 0 1 1-3 0 1.5 1.5 0 0 1 3 0m0-5a1.5 1.5 0 1 1-3 0 1.5 1.5 0 0 1 3 0m0-5a1.5 1.5 0 1 1-3 0 1.5 1.5 0 0 1 3 0"/></svg></summary>
<ul>
<li><a href="#">Action</a></li>
<li><a href="#">Another action</a></li>
<li><a href="#">Super large text longer than the button</a></li>
</ul>
</details>
</div>Multi-level menu
Multiple menu
<details class="dropdown">
<summary class="btn">
Multiple menu
<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" fill="currentColor" viewBox="0 0 16 16"><path fill-rule="evenodd" d="M1.646 4.646a.5.5 0 0 1 .708 0L8 10.293l5.646-5.647a.5.5 0 0 1 .708.708l-6 6a.5.5 0 0 1-.708 0l-6-6a.5.5 0 0 1 0-.708"/></svg>
</summary>
<ul>
<li><a href="#">Action</a></li>
<li>
<details class="dropdown dropright">
<summary>
Multiple menu
<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" fill="currentColor" viewBox="0 0 16 16"><path fill-rule="evenodd" d="M4.646 1.646a.5.5 0 0 1 .708 0l6 6a.5.5 0 0 1 0 .708l-6 6a.5.5 0 0 1-.708-.708L10.293 8 4.646 2.354a.5.5 0 0 1 0-.708"/></svg>
</summary>
<ul>
<li><a href="#">Action</a></li>
<li><a href="#"><svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" fill="currentColor" viewBox="0 0 16 16"><path d="M8 1a2.5 2.5 0 0 1 2.5 2.5V4h-5v-.5A2.5 2.5 0 0 1 8 1m3.5 3v-.5a3.5 3.5 0 1 0-7 0V4H1v10a2 2 0 0 0 2 2h10a2 2 0 0 0 2-2V4zM2 5h12v9a1 1 0 0 1-1 1H3a1 1 0 0 1-1-1z"/></svg> Another action with icon</a></li>
<li><hr></li>
<li><a href="#">Something else here</a></li>
</ul>
</details>
</li>
<li><a href="#">Another action</a></li>
<li><a href="#">Something else here</a></li>
</ul>
</details>Universal sizes
You can simply apply .sm and .lg on the root.
Small menu
Default menu
Large menu
<div class="flex-row" style="align-items: center">
<details class="dropdown sm">
<summary class="btn sm">Small menu <svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" fill="currentColor" viewBox="0 0 16 16"><path fill-rule="evenodd" d="M1.646 4.646a.5.5 0 0 1 .708 0L8 10.293l5.646-5.647a.5.5 0 0 1 .708.708l-6 6a.5.5 0 0 1-.708 0l-6-6a.5.5 0 0 1 0-.708"/></svg></summary>
<ul>
<li><a href="#">Action</a></li>
<li><a href="#">Another action</a></li>
</ul>
</details>
<details class="dropdown">
<summary class="btn">Default menu <svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" fill="currentColor" viewBox="0 0 16 16"><path fill-rule="evenodd" d="M1.646 4.646a.5.5 0 0 1 .708 0L8 10.293l5.646-5.647a.5.5 0 0 1 .708.708l-6 6a.5.5 0 0 1-.708 0l-6-6a.5.5 0 0 1 0-.708"/></svg></summary>
<ul>
<li><a href="#">Action</a></li>
<li><a href="#">Another action</a></li>
</ul>
</details>
<details class="dropdown lg">
<summary class="btn lg">Large menu <svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" fill="currentColor" viewBox="0 0 16 16"><path fill-rule="evenodd" d="M1.646 4.646a.5.5 0 0 1 .708 0L8 10.293l5.646-5.647a.5.5 0 0 1 .708.708l-6 6a.5.5 0 0 1-.708 0l-6-6a.5.5 0 0 1 0-.708"/></svg></summary>
<ul>
<li><a href="#">Action</a></li>
<li><a href="#">Another action</a></li>
</ul>
</details>
</div>Burger menu variant
The burger button is not a separate component: it is a dropdown whose trigger is a round button with an <i><span></span></i> inside. The .burger-menu class morphs the three CSS lines into an × when open, and because the list is wrapped in a <nav>, the links keep the nav styling instead of the compact menu item styling. This makes it ideal for mobile and full-screen navigation.
<details class="burger-menu dropdown dropdown-align-right">
<summary class="btn btn-round lg">
<i><span></span></i>
</summary>
<nav>
<ul>
<li><a href="#">Start</a></li>
<li><a href="#typography">Typography</a></li>
<li><a href="#overlays">Overlays</a></li>
<li><a href="#forms">Forms</a></li>
<li><a href="#" class="btn sm">Menu button</a></li>
</ul>
</nav>
</details>