Skip to main content

Button

Triggers one action.

Run query Delete asset
<mm-button variant="primary" icon="play-arrow">Run query</mm-button>
<mm-button variant="danger" icon="delete">Delete asset</mm-button>
<mm-button variant="ghost" icon="content-copy" label="Copy MRN"></mm-button>

Guidance​

Buttons trigger one action, labelled with a verb plus an object ("Run query", "Add plugin", "Delete asset"). One primary per view region. Danger buttons always carry an icon and a word naming what is destroyed. Hover changes colour only: buttons never lift or scale, and labels never end in "→".

Icon-only buttons need label, which is announced and shown as a tooltip.

Properties​

PropertyAttributeTypeDefaultDescription
variantvariant'primary' | 'secondary' | 'ghost' | 'danger''secondary'primary, secondary (default), ghost or danger.
sizesize'md' | 'sm''md'md (36px, default) or sm (30px).
iconiconstring''Leading Material Symbols icon name. Required for danger.
labellabelstring''Accessible name for icon-only buttons; also shown as an instant tooltip. Setting it with no slotted text makes the button icon-only.
disableddisabledbooleanfalse
loadingloadingbooleanfalseShows a spinner, keeps the label, and blocks activation.
typetype'button' | 'submit' | 'reset''button'button (default), submit or reset. Submit and reset work with the closest form.
hrefhrefstring''Renders a link styled as a button.
targettargetstring''
externalexternalbooleanfalseWith href: opens in a new tab, with a trailing arrow and "(opens in a new tab)" for screen readers. For places outside Marmot.
namenamestring''
valuevaluestring''
pressedpressed'true' | 'false' | undefinedReflects aria-pressed for toggle buttons.
expandedexpanded'true' | 'false' | undefinedReflects aria-expanded for buttons that control a menu or disclosure.
controlscontrolsstring''
haspopuphaspopup'menu' | 'listbox' | 'dialog' | undefined
form

Slots​

SlotDescription
DefaultThe label.
iconA leading icon, if you need more than the icon attribute.

CSS parts​

PartDescription
buttonThe native button or link.
iconThe leading icon.
labelThe label wrapper.
spinnerThe loading indicator.

Examples​

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