Options ​
Set defaults globally via the Vue plugin or the Nuxt module, and override per toast.
| Option | Type | Default | Description |
|---|---|---|---|
duration | number | 4000 | Auto-dismiss delay in ms. 0 disables. |
position | string | 'top-right' | Default position for toasts. |
dismissible | boolean | true | Whether 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>