Toast

A lightweight notification stack for success, warning, error and info messages.

Installation

npx alixan-ui-nuxt add toast

Usage

app.vue
<template>
  <NuxtPage />
  <ToastHost /> <!-- Add ToastHost once near the root. It renders only on the client. -->
</template>
Example.vue
<script setup lang="ts">
const toast = useToast()

const showToast = () => {
  toast.open('Project saved successfully', 'success')
}
</script>

<template>
  <Button @click="showToast">Show toast</Button>
</template>

API Reference

ArgumentTypeDefaultDescription
messagestring-Toast text.
type'success' | 'warning' | 'error' | 'info''info'Semantic toast tone.
durationnumber4000Auto-close timeout in milliseconds.