windx-foobar / nuxt3-notifications

Nuxt 3 notification library 🗨️
https://windx-foobar.github.io/nuxt3-notifications/
MIT License
21 stars 5 forks source link

Nuxt3 Notifications Module

Version Downloads License Nuxt

This is module @kyvg/vue3-notification for Nuxt3

📦 Get Started

  1. Install nuxt3-notifications as project dependency:
npm install --save-dev nuxt3-notifications # npm
yarn add -D nuxt3-notifications # yarn classic
pnpm i -D nuxt3-notifications # pnpm
  1. Add it to the modules section of your nuxt.config:
export default defineNuxtConfig({
  modules: ['nuxt3-notifications'],
});

🚀 Example

<!-- app.vue -->
<template>
  <NuxtNotifications position="bottom left" :speed="500" />
</template>
<!-- page.vue/component.vue -->

<script setup>
  const { notify } = useNotification();

  function onClick() {
    notify({
      title: "Title",
      text: "Hello notify!",
    });
  }
</script>

<template>
  <button @click="onClick">Show notify</button>
</template>

🔨 Config

export default defineNuxtConfig({
  modules: ['nuxt3-notifications'],
  nuxtNotifications: {
    componentName: 'Foo' // 'foo-bar' or 'FooBar' for components of two or more words
  },
});

💻 Development