Skip to main content

Menu button

A button that opens a menu.

Copy MRN Open in Query Delete asset
<mm-menu-button variant="ghost" icon="more-horiz" label="More actions" icon-only>
<mm-menu>
<mm-menu-item icon="content-copy">Copy MRN</mm-menu-item>
<mm-menu-item icon="terminal">Open in Query</mm-menu-item>
<mm-menu-separator></mm-menu-separator>
<mm-menu-item icon="delete" danger value="delete">Delete asset</mm-menu-item>
</mm-menu>
</mm-menu-button>

Guidance​

A menu button opens a menu of secondary actions: the "More" button on an asset row or page header. The trigger is an mm-button with aria-haspopup="menu" and aria-expanded; the menu is a slotted mm-menu. Use an icon-only ghost button (icon="more-horiz" with label) for row actions, or a labelled button with a chevron where the menu needs naming.

Keyboard (https://www.w3.org/WAI/ARIA/apg/patterns/menu-button/): Enter, Space and ArrowDown open the menu and focus its first item; ArrowUp opens it on the last item. Escape closes it and returns focus to the button.

Properties​

PropertyAttributeTypeDefaultDescription
variantvariant'primary' | 'secondary' | 'ghost''secondary'Trigger variant: secondary (default), ghost or primary.
sizesize'md' | 'sm''md'md (default) or sm.
iconiconstring''Leading icon. With icon-only, the only thing shown.
labellabelstring''The button text, or the accessible name and tooltip when icon-only. Defaults to "More actions".
iconOnlyicon-onlybooleanfalseShows only the icon; label becomes the accessible name.
disableddisabledbooleanfalse
placementplacementPlacement'bottom-start'Placement of the menu against the button.
openopenbooleanfalseWhether the menu is open.
menuMmMenu | nullThe slotted menu.

Methods​

MethodDescription
show()Opens the menu and focuses its first (or last) item.

Slots​

SlotDescription
DefaultOne mm-menu.

CSS parts​

PartDescription
triggerThe mm-button trigger.
buttonThe trigger's native button, for joining it to other buttons.

Examples​

Every state of mm-menu-button in Storybook, with keyboard and screen reader tests.