Skip to content

Button

Buttons communicate actions that users can take. Vue Material 3 provides the Material Design 3 button variants as separate Vue components.

Variants

ComponentUse case
MdFilledButtonHigh-emphasis primary actions.
MdFilledTonalButtonMedium-emphasis actions that need a filled surface.
MdElevatedButtonActions that need separation from the background.
MdOutlinedButtonMedium-emphasis actions without a filled container.
MdTextButtonLow-emphasis actions, compact toolbars, and inline actions.

Import

js
import { MdFilledButton, MdOutlinedButton, MdTextButton } from 'vue-material-3';

Usage

Use the label prop for simple text buttons:

vue
<template>
  <MdFilledButton label="Save" />
  <MdOutlinedButton label="Cancel" />
</template>

<script setup>
import { MdFilledButton, MdOutlinedButton } from 'vue-material-3';
</script>

Use the default slot when the label needs custom content:

vue
<template>
  <MdTextButton>Learn more</MdTextButton>
</template>

<script setup>
import { MdTextButton } from 'vue-material-3';
</script>

Icons

Buttons support a trailing icon through either the trailingIcon prop or the trailing-icon slot.

vue
<template>
  <MdFilledButton label="Next" trailing-icon="arrow_forward" />
</template>

<script setup>
import { MdFilledButton } from 'vue-material-3';
</script>

When href is provided, the component renders an anchor instead of a native button.

vue
<template>
  <MdTextButton label="Open docs" href="/docs" target="_blank" />
</template>

<script setup>
import { MdTextButton } from 'vue-material-3';
</script>

Props

All button variants share the same public props.

PropTypeDefaultDescription
labelstringundefinedText rendered inside the button. Falls back to the default slot when omitted.
trailingIconstringundefinedMaterial Symbols icon name rendered after the label.
disabledbooleanfalseDisables native button interaction. For link buttons, click is prevented and aria-disabled is set.
softDisabledbooleanfalseApplies disabled styling and prevents click behavior while keeping the element focus behavior softer than disabled.
hrefstring''Renders the button as an anchor when provided.
targetstring''Anchor target used with href.
downloadstring''Anchor download attribute used with href.
typestring'button'Native button type when the component renders a <button>.

Slots

SlotDescription
defaultButton label content used when label is not provided.
trailing-iconCustom trailing icon content. Overrides trailingIcon.

Accessibility

  • Native buttons receive the disabled attribute when disabled is true.
  • Link buttons receive aria-disabled when disabled or softDisabled is true.
  • Disabled link buttons prevent click behavior.
  • Use clear action labels; icon-only actions should use MdIconButton instead.

Storybook

Use Storybook to inspect button variants interactively.