Nuxt β
Setup β
Add the module. The container mounts automatically and the composables are auto-imported β nothing else to wire up.
ts
// nuxt.config.ts
export default defineNuxtConfig({
modules: ['notifications-kit/nuxt'],
notifications: {
position: 'top-right',
duration: 4000,
},
})Usage β
useToast and useConfirm are available everywhere without an import:
vue
<script setup lang="ts">
const toast = useToast()
const { confirm } = useConfirm()
async function save() {
await toast.promise(saveData(), {
loading: 'Savingβ¦',
success: 'Saved!',
error: 'Failed to save',
})
}
</script>
<template>
<button @click="save">Save</button>
</template>Because notifications touch the DOM, the container is registered as a client plugin β it only runs in the browser, which avoids SSR issues automatically.