Skip to content

MToast <m-toast> ​

A notification that streaks in as a smear, lands in dust with ズザッ, wobbles and leaves by shrinking. Place it where toasts should appear and call show('Saved'). It is a polite live region.

Demo source
vue
<script setup lang="ts">
import { useTemplateRef } from 'vue';
import { MButton, MToast, type ToastExpose } from 'vue-manga-ui';

const toast = useTemplateRef<ToastExpose>('toast');
</script>

<template>
  <div class="col">
    <MButton variant="secondary" @click="toast?.show('Saved!')">Show toast</MButton>
    <MToast ref="toast" />
  </div>
</template>

Props ​

PropTypeDefaultDescription
durationnumber2.6Seconds the toast stays; 0 keeps it until hide().

Other HTML attributes (id, class, aria-*, data-*…) fall through to the component’s element and are type-checked.

Exposed (via template ref) ​

MethodSignatureDescription
show(text: string) => voidShow text. Showing again while open replaces the text and restarts the timer.
hide() => voidShrink away now.