Toast
<script lang="ts" setup>import { NNToasts, NNButton, useToasts } from "@fronntui/vue";
const { add, clear, close } = useToasts();
const open = (type: "info" | "warning" | "success" | "error") => { add({ type, title: "My Toast", message: "optional message", autoClose: 2000 });};</script>
<template> <NNButton @click="open('info')">info</NNButton> <NNButton @click="open('success')">success</NNButton> <NNButton @click="open('warning')">warning</NNButton> <NNButton @click="open('error')">error</NNButton>
<!-- place NNToasts once in the app --> <NNToasts /></template>Exposed
Name
Arguments
add ({ type: ToastType; title: string; message?: string; action?: { fn: (toast: { id: string }) => void; label: string }; autoClose?: number; }) => void Add a toast.
close (id: string) => void Close toast with id.
clear Clear all toasts.