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
| Prop | Type | Default | Description |
|---|---|---|---|
duration | number | 2.6 | Seconds 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)
| Method | Signature | Description |
|---|---|---|
show | (text: string) => void | Show text. Showing again while open replaces the text and restarts the timer. |
hide | () => void | Shrink away now. |