Appearance
push
ts
import { push, type Push } from 'notivue'
Object containing methods to create, dismiss and destroy notifications.
Push Object Methods
Method | Description | Param | Return |
---|---|---|---|
success | Push a success notification | string | PushOptions | PushClearMethods |
error | Push an error notification | string | PushOptions | PushClearMethods |
warning | Push a warning notification | string | PushOptions | PushClearMethods |
info | Push an info notification | string | PushOptions | PushClearMethods |
promise | Push a pending notification | string | PushOptions | PushPromiseReturn |
load | Push a pending notification (alias of promise ) | string | PushOptions | PushPromiseReturn |
clearAll | Dismiss all notifications by playing clearAll animation. | - | void |
destroyAll | Dismiss all notifications without playing any animation. | - | void |
Interfaces
ts
type PushOptions = NotificationOptions &
PushProps &
PushSpecificOptions &
PushCallbacks
interface NotificationOptions {
title?: string
message?: string
duration?: number
ariaLive?: 'polite' | 'assertive'
ariaRole?: 'alert' | 'status'
}
interface PushProps {
props?: Record<string, any>
}
interface PushSpecificOptions {
skipQueue?: boolean
ariaLiveOnly?: boolean
}
interface PushCallbacks {
onAutoClear?: (item: NotivueItem) => void
onManualClear?: (item: NotivueItem) => void
}
interface PushClearMethods {
clear: () => void
destroy: () => void
}
type PushPromiseReturn = PushClearMethods & {
resolve: (options: string | PushOptions) => PushClearMethods
reject: (options: string | PushOptions) => PushClearMethods
//👇 Aliases of `resolve` and `reject` respectively
success: (options: string | PushOptions) => PushClearMethods
error: (options: string | PushOptions) => PushClearMethods
}