Skip to content

Options ​

Set defaults globally via the Vue plugin or the Nuxt module, and override per toast.

OptionTypeDefaultDescription
durationnumber4000Auto-dismiss delay in ms. 0 disables.
positionstring'top-right'Default position for toasts.
dismissiblebooleantrueWhether toasts show a close button.

Positions: top-left, top-center, top-right, bottom-left, bottom-center, bottom-right.

Setting defaults ​

ts
app.use(NotificationsKit, { position: 'bottom-center', duration: 5000 })
ts
export default defineNuxtConfig({
  modules: ['notifications-kit/nuxt'],
  notifications: { position: 'bottom-center', duration: 5000 },
})

Per-toast override ​

ts
toast.success('Saved!', { position: 'top-left', duration: 0 })

API summary ​

ts
const toast = useToast()
toast.success(message, options?)
toast.error(message, options?)
toast.warning(message, options?)
toast.info(message, options?)
toast.loading(message, options?)
toast.promise(promise, { loading, success, error }, options?)
toast.dismiss(id)
toast.clear()

const { confirm, prompt } = useConfirm()
confirm(message, { title?, confirmText?, cancelText?, danger? }) // => Promise<boolean>
prompt(message, { placeholder?, defaultValue?, ...confirmOptions }) // => Promise<string | null>

Released under the MIT License.