Menu

A short list of actions on one thing, opened from a button: the "More" at the end of a profile's row, the menu behind the top bar.

HTML
<div class="bm-stage">
  <div class="bm-stack" style="width:320px;align-items:flex-end">
    <section class="bm-tile" style="width:100%"><div class="bm-setting"><span><span class="bm-item__title">Adaptive v2</span><div class="bm-item__meta">93° · 36 g · 3 phases</div></span><button class="bm-btn bm-btn--icon bm-btn--quiet" aria-label="More actions for Adaptive v2" aria-haspopup="menu" aria-expanded="true" aria-controls="m1"><span data-icon="more-horizontal"></span></button></div></section>
    <div class="bm-menu" id="m1" role="menu" style="margin-top:calc(var(--space-5) * -1);margin-right:var(--space-5)">
      <button class="bm-menu__item" role="menuitem"><span data-icon="pencil" data-size="20"></span><span class="bm-menu__label">Edit</span></button>
      <button class="bm-menu__item is-hover" role="menuitem"><span data-icon="info" data-size="20"></span><span class="bm-menu__label">Details</span></button>
      <button class="bm-menu__item" role="menuitem"><span data-icon="download" data-size="20"></span><span class="bm-menu__label">Export as JSON</span></button>
      <div class="bm-menu__sep" role="separator"></div>
      <button class="bm-menu__item bm-menu__item--danger" role="menuitem"><span data-icon="trash-2" data-size="20"></span><span class="bm-menu__label">Delete profile</span></button>
    </div>
  </div>
  <div class="bm-stack" style="width:280px">
    <span class="bm-eyebrow">With a checked item and a hint</span>
    <div class="bm-menu" role="menu" aria-label="Sort shots">
      <button class="bm-menu__item" role="menuitemradio" aria-checked="true"><span class="bm-menu__label">Newest first</span><span data-icon="check" data-size="20"></span></button>
      <button class="bm-menu__item" role="menuitemradio" aria-checked="false"><span class="bm-menu__label">Longest first</span></button>
      <button class="bm-menu__item" role="menuitemradio" aria-checked="false"><span class="bm-menu__label">By profile</span><span class="bm-menu__hint">12</span></button>
      <button class="bm-menu__item" role="menuitemradio" aria-checked="false" aria-disabled="true"><span class="bm-menu__label">By rating</span></button>
    </div>
  </div>
</div>
  • Use it for two to six actions that do not deserve their own buttons. One action is a Button; a choice of value is a Select or a Segmented control.
  • Order by how often each is used, and put the destructive action last, under a separator.
  • On a phone a Menu with more than four items opens as a sheet (Dialog) instead of a popover.

Anatomy

.bm-menu: a surface-2 block with a line-strong hairline, radius-lg, space-1 of padding, 200 to 280 px wide, on layer-menu. The hairline is what separates it from the tile under it, since nothing here has a shadow. Each .bm-menu__item is 44 px tall, radius-md, with an optional 20 px icon, its label in .bm-menu__label (body), and an optional .bm-menu__hint at the right in data. .bm-menu__sep is a line hairline. It opens below its button, aligned to the button's right edge, space-1 away, and flips above when there is no room.

States

StateFillLabel
Restnoneink
Hover, pressed, keyboard highlightstate-hoverink
Destructive (bm-menu__item--danger)none, then danger-softdanger
Checked (aria-checked="true")noneink, with a check at the right
Disablednoneink-faint
Focusthe focus ring

Enter: opacity and a 16 px rise in duration-base; leave in duration-fast.

Content

  • A verb, or a verb and its object, sentence case, at most 24 characters: "Edit", "Export as JSON", "Delete profile".
  • No item called "More". No nested menus.
  • A destructive item opens a Dialog; it never acts at once.

Keyboard and screen reader

  • The opening button has aria-haspopup="menu", aria-expanded, and aria-controls pointing at the Menu.
  • The Menu is role="menu"; items are role="menuitem" (or menuitemradio with aria-checked). The separator is role="separator".
  • Opening moves focus to the first item. Up and Down move, Home and End jump, typing a letter jumps to a match, Enter or Space activates, Escape closes and returns focus to the button, Tab closes and moves on.
  • A press outside closes it without acting.