What's Changed
Vue Sonner now supports a Nuxt 3 module
Use vue-sonner/nuxt
module
// nuxt.config.ts
export default defineNuxtConfig({
...
modules: ['vue-sonner/nuxt']
})
Use Toaster
component and $toast
function anywhere in the Vue SFC
<!-- app.vue -->
<template>
<div>
<Toaster position="top-right" />
<button @click="() => $toast('My first toast')">Render a toast</button>
</div>
</template>
<script setup lang="ts">
const { $toast } = useNuxtApp()
</script>
Full Changelog: v1.2.3...v1.2.4