Skip to main content

Split button

A primary action with a menu of alternatives.

Run and export CSV Explain query
<mm-split-button label="Run query" icon="play-arrow" menu-label="More run options">
<mm-menu>
<mm-menu-item icon="download" value="run-export">Run and export CSV</mm-menu-item>
<mm-menu-item icon="account-tree" value="explain">Explain query</mm-menu-item>
</mm-menu>
</mm-split-button>

Guidance​

A split button pairs one primary action with a chevron menu of close alternatives: "Run query" with "Run and export CSV" and "Explain query". The two parts share one border and join with square inner corners; each has its own focus ring and tab stop. Use it only when the main action is clearly the common case. If the alternatives are equally likely, use a menu button instead.

The chevron follows the menu button keyboard model (https://www.w3.org/WAI/ARIA/apg/patterns/menu-button/).

Properties​

PropertyAttributeTypeDefaultDescription
variantvariant'primary' | 'secondary''primary'primary (default) or secondary.
sizesize'md' | 'sm''md'md (default) or sm.
labellabelstring''Text of the primary action, a verb and an object.
iconiconstring''Leading icon of the primary action.
menuLabelmenu-labelstring''Accessible name of the chevron. Defaults to "More actions"; name the alternatives where you can ("More run options").
groupLabelgroup-labelstring''Accessible name of the group. Defaults to label.
disableddisabledbooleanfalse
loadingloadingbooleanfalseShows a spinner on the primary part and blocks it; the menu stays available.
toggleMmMenuButton | nullThe chevron menu button.

Events​

EventDetailDescription
mm-actionCustomEvent<Record<string, never>>The primary part was activated.

Slots​

SlotDescription
DefaultOne mm-menu holding the alternatives.

CSS parts​

PartDescription
actionThe primary mm-button.
toggleThe chevron mm-menu-button.

Examples​

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