Skip to content
On this page

Common Button ​

The Common Button is a button that is used in many places in the application. It is a button that has a text and an icon. The icon is optional. The button can be disabled.

Type ​

NameDescription
TonalButtonA button that has a tonal background.
ElevatedButtonA button that has an elevated background.
TextButtonA button that has a text.
FilledButtonA button that has a filled background.
OutlinedButtonA button that has an outlined background.

Props ​

NameTypeDefaultDescription
typeString'elevated'The type of the button.
iconStringThe name of the icon shown in the button.
iconTypeString'material'The type of the icon.
disabledBooleanfalseIf the button is disabled.

type ​

Available values:

  • 'tonal'
  • 'elevated'
  • 'text'
  • 'filled'
  • 'outlined'

icon and iconType ​

Look at the Mty Icons for more information.

Events ​

NameDescription
clickEmitted when the button is clicked.

slots ​

NameDescription
defaultThe text label of the button.

Usage ​

The following example shows how to use the Common Button. It is a tonal button with an add icon and a label "Add item". When the button is clicked, the onClick method is called.

jsx
// As custom element
<common-button icon="add" type="tonal" @click="onClick">
  Add item
</common-button>

// As component
<CommonButton icon="add" type="tonal" @click="onClick">
  Add item
</CommonButton>