Skip to content

Vue Plugin & Nuxt Module

Vue plugin

ts
import { VueToastPlugin } from 'vue-toast-kit'
import 'vue-toast-kit/style'

app.use(VueToastPlugin, {
  position: 'bottom-right',
  maxVisible: 5,
  duration: 4000,
  theme: 'system',
  closable: true,
  pauseOnHover: true,
  pauseOnFocusLoss: true,
  registerComponent: true, // auto-register <ToastContainer> globally
})

VueToastPluginOptions

OptionTypeDefaultDescription
positionToastPosition'bottom-right'Default container position
maxVisiblenumber5Default maximum visible toasts
durationnumber4000Default auto-dismiss duration in ms
theme'light' | 'dark' | 'system'Default theme for all containers
closablebooleantrueShow close button by default
pauseOnHoverbooleantruePause on hover by default
pauseOnFocusLossbooleantruePause on tab background by default
ignoreSSRbooleanfalseDisable SSR buffering
registerComponentbooleantrueGlobally register <ToastContainer>
rateLimitnumberMax toasts added within rateLimitWindowMs; extras are silently dropped
rateLimitWindowMsnumber1000Window in ms for rate limiting
persistStoragebooleanfalseEnable localStorage persist/restore for toasts with persist: true

Nuxt module

ts
// nuxt.config.ts
export default defineNuxtConfig({
  modules: ['vue-toast-kit/nuxt'],

  vueToastKit: {
    position: 'bottom-right',
    maxVisible: 5,
    duration: 4000,
    theme: 'system',
    closable: true,
    pauseOnHover: true,
    pauseOnFocusLoss: true,
    registerComponent: true,
  },
})

The module automatically:

  • Adds the Vue plugin on the client
  • Auto-imports useToast, useToastState, createToastContext, and the toast singleton — no explicit import needed
  • Auto-imports <ToastContainer> as a global component (when registerComponent: true)
  • Injects vue-toast-kit/style.css into the Nuxt CSS pipeline

CSS is loaded automatically — no manual import of vue-toast-kit/style required in Nuxt.