Button

Action Button

Interactive Demo

searchControlled

Note: color is not part of the official Material Design 3. Color of tonal buttons is always secondary container. Color of outlined buttons is always on outline variant.

Configurations

Varients

FilledTonalsearchElevatedOutlinedText
<md-button>Filled</md-button>
<md-button variant="tonal">Tonal</md-button>
<md-button variant="elevated">
  <md-icon slot="icon">search</md-icon>
  Elevated
</md-button>
<md-button variant="outlined">Outlined</md-button>
<md-button variant="text">Text</md-button>

Icon

SendsendOpenopen_in_new
<md-button variant="tonal">
  Send
  <md-icon slot="icon">send</md-icon>
</md-button>

<md-button variant="text" trailingicon>
  Open
  <md-icon slot="icon">open_in_new</md-icon>
</md-button>

Properties

NameTypeDefaultDescription
color'primary' | 'secondary' | 'tertiary''primary'The color variant of the button.
shape'rounded' | 'square''rounded'The shape of the button.
size'xsmall' | 'small' | 'medium' | 'large' | 'xlarge''small'The size of the button.
trailingIconBooleanfalseWhether the icon is displayed at the end of the button.
variant'filled' | 'tonal' | 'elevated' | 'outlined' | 'text''filled'The visual style variant of the button.
type'button' | 'submit' | 'reset''button'The button type (inherited from Button).
disabledBooleanfalseWhether the button is disabled (inherited from FormAssociated).

Methods

Inherits all standard HTMLElement methods. Use click() to programmatically trigger the button.

Toggle Button

Interactive Demo

bookmarkbookmarkBookmark Bookmarked

Usage

pauseStop Startreplay
<div style="display: flex; align-items: center; justify-content: center; gap: 8px;">
  <md-icon-button variant="tonal" width="narrow" aria-label="Pause">
    <md-icon>pause</md-icon>
  </md-icon-button>
  <md-button-toggle size="medium" checked>
    <span>Stop</span>
    <span slot="checked">Start</span>
  </md-button-toggle>
  <md-icon-button variant="outlined" width="narrow" aria-label="Restart">
    <md-icon>replay</md-icon>
  </md-icon-button>
</div>

Properties

NameTypeDefaultDescription
checkedBooleanfalseWhether the button is in the checked state (inherited from Switch).
color'primary' | 'secondary' | 'tertiary''primary'The color variant of the button.
shape'rounded' | 'square''rounded'The shape of the button.
size'xsmall' | 'small' | 'medium' | 'large' | 'xlarge''small'The size of the button.
trailingIconBooleanfalseWhether the icon is displayed at the end of the button.
variant'filled' | 'tonal' | 'elevated' | 'outlined''filled'The visual style variant of the button.
type'button' | 'submit' | 'reset''button'The button type (inherited from Button).
disabledBooleanfalseWhether the button is disabled (inherited from FormAssociated).

Events

NameTypeDescription
changeCustomEvent<boolean>Dispatched when the checked state changes. The detail property contains the new checked state.