Skip to content

Installation

Getting Nuxt Toastify running takes one step: add the module. There’s no component to mount and no stylesheet to import — the module handles both.

The quickest way is the Nuxt CLI, which installs the package and adds it to your nuxt.config for you:

Terminal window
npx nuxi@latest module add nuxt-toastify

If you’d rather install it by hand, add the package with your preferred package manager:

Terminal window
# pnpm
pnpm add nuxt-toastify
Terminal window
# npm
npm install nuxt-toastify
Terminal window
# yarn
yarn add nuxt-toastify

Then add 'nuxt-toastify' to the modules array in nuxt.config.ts:

export default defineNuxtConfig({
modules: ['nuxt-toastify'],
})

The module is zero-config — it works the moment it’s registered. If you want to change the global behavior, add a toastify key to nuxt.config.ts. These settings apply to every toast unless overridden per call:

export default defineNuxtConfig({
modules: ['nuxt-toastify'],
toastify: {
autoClose: 2000,
position: 'top-right',
theme: 'auto',
},
})

See Configuration for the full list of options and their defaults.

You don’t have to import any stylesheet. The module automatically registers a client plugin and injects vue3-toastify/dist/index.css, so toasts are styled correctly the moment you call useToastify().

  • Usage — fire your first toast with useToastify().
  • Configuration — change the global defaults (position, theme, duration, and more).