Menus offer a contextual set of options in a Popover.
Use for a single-level menu of options.
<div class="mds-menu mds-menu--sticky">
<div class="mds-popover__wrapper mds-popover--overlay-closable">
<button class="mds-button mds-popover__target mds-button--secondary" type="button" data-mds-popover='mds-popover--58874' role="button">
<span class="mds-button__text"> Menu </span>
<svg class="mds-icon mds-button__icon mds-button__icon--right" aria-hidden="true">
<use xlink:href="/assets/icons/mds_icons.svg#caret-down--s"> </use>
</svg>
</button>
<div class="mds-popover__overlay"></div>
<div id="mds-popover--58874" class="mds-popover mds-popover mds-popover--bottom-center mds-popover--width-l" role="tooltip">
<header class="mds-popover__header">
<h3 class="mds-popover__title"> Workbook </h3>
</header>
<div class="mds-popover__content">
<ul class="mds-list-group">
<li class="mds-list-group__item ">
<a href="#" class="mds-list-group__link">
<span class="mds-list-group__item-label"> Create New </span>
</a>
</li>
<li class="mds-list-group__item ">
<a href="#" class="mds-list-group__link">
<span class="mds-list-group__item-label"> Open </span>
</a>
</li>
<li class="mds-list-group__item mds-list-group__item--disabled">
<a href="#" class="mds-list-group__link">
<span class="mds-list-group__item-label"> Save </span>
</a>
</li>
<li class="mds-list-group__item ">
<a href="#" class="mds-list-group__link">
<span class="mds-list-group__item-label"> Save As </span>
</a>
</li>
</ul>
</div>
</div>
</div>
</div>
<div class="mds-menu mds-menu--sticky">
<div class="mds-popover__wrapper mds-popover--overlay-closable">
<button class="mds-button mds-popover__target mds-button--secondary" type="button" data-mds-popover='mds-popover--19978' role="button">
<span class="mds-button__text"> Menu </span>
<svg class="mds-icon mds-button__icon mds-button__icon--right" aria-hidden="true">
<use xlink:href="/assets/icons/mds_icons.svg#caret-down--s"> </use>
</svg>
</button>
<div class="mds-popover__overlay"></div>
<div id="mds-popover--19978" class="mds-popover mds-popover mds-popover--bottom-center mds-popover--width-l" role="tooltip">
<div class="mds-popover__content">
<ul class="mds-list-group">
<li class="mds-list-group__item ">
<a href="#" class="mds-list-group__link">
<span class="mds-list-group__item-label"> Create New </span>
</a>
</li>
<li class="mds-list-group__item ">
<a href="#" class="mds-list-group__link">
<span class="mds-list-group__item-label"> Open </span>
</a>
</li>
<li class="mds-list-group__item mds-list-group__item--disabled">
<a href="#" class="mds-list-group__link">
<span class="mds-list-group__item-label"> Save </span>
</a>
</li>
<li class="mds-list-group__item ">
<a href="#" class="mds-list-group__link">
<span class="mds-list-group__item-label"> Save As </span>
</a>
</li>
</ul>
</div>
</div>
</div>
</div>
Include an icon to indicate a default or previously chosen item from a list of options.
<div class="mds-menu mds-menu--sticky">
<div class="mds-popover__wrapper mds-popover--overlay-closable">
<button class="mds-button mds-popover__target mds-button--secondary" type="button" data-mds-popover='mds-popover--53642' role="button">
<span class="mds-button__text"> Menu </span>
<svg class="mds-icon mds-button__icon mds-button__icon--right" aria-hidden="true">
<use xlink:href="/assets/icons/mds_icons.svg#caret-down--s"> </use>
</svg>
</button>
<div class="mds-popover__overlay"></div>
<div id="mds-popover--53642" class="mds-popover mds-popover mds-popover--bottom-center mds-popover--width-l" role="tooltip">
<div class="mds-popover__content">
<ul class="mds-list-group">
<li class="mds-list-group__item mds-list-group__item--highlighted">
<a href="#" class="mds-list-group__link">
<span class="mds-list-group__item-label"> Create New </span>
<svg class="mds-icon mds-list-group__link-icon" aria-hidden="true">
<use xlink:href="/assets/icons/mds_icons.svg#check--s"> </use>
</svg>
</a>
</li>
<li class="mds-list-group__item ">
<a href="#" class="mds-list-group__link">
<span class="mds-list-group__item-label"> Open </span>
</a>
</li>
<li class="mds-list-group__item mds-list-group__item--disabled">
<a href="#" class="mds-list-group__link">
<span class="mds-list-group__item-label"> Save </span>
</a>
</li>
<li class="mds-list-group__item ">
<a href="#" class="mds-list-group__link">
<span class="mds-list-group__item-label"> Save As </span>
</a>
</li>
</ul>
</div>
</div>
</div>
</div>
check--s
, to indicate selected item.mds-text-color-link-default
for selected-item text and $mds-interactive-color-primary-default
for selected-item icon.caret-down--s
.caret-down--s
, is included to the right of the label.escape
.As menu is simply a wrapper, the accessibility guidelines covered in Popovers and List Groups should be followed, with the following caveats:
role=”tooltip”
to role=”menu”
to present a list of actions, mds-list-group
.role=”menuitem”
to link items, mds-list-group__item
.aria-labelledby=”XXX”
attribute, where ”XXX” represents the ID of a trigger button.tabindex=”-1”
to both Popover, mds-popover
, and List Group links item, mds-list-group__item
.Additionally, update the Button component that triggers the menu to change its behavior:
aria-haspopup=”true”
to the trigger.aria-expanded=”false”
to the trigger button and value is dynamically updated to true
when menu is open.aria-controls=”XXX”
to trigger button, where ”XXX” represents the ID of the Popover.Follow class reference sections in Popovers and List Groups.