@tauri-apps/plugin-notification
Send toast notifications (brief auto-expiring OS window element) to your user. Can also be used with the Notification Web API.
Default: 3;High: 4;Low: 2;Min: 1;None: 0;Day: "day";Hour: "hour";Minute: "minute";Month: "month";Second: "second";Not supported on iOS.
TwoWeeks: "twoWeeks";Week: "week";Year: "year";Private: 0;Public: 1;Secret: -1;new Schedule(): Schedule| Property | Type | Defined in |
|---|---|---|
at | undefined | object | Source: https://github.com/bearBoy80/tauri/blob/v2/packages/plugins-workspace/plugins/notification/guest-js/index.ts#L175 |
every | undefined | object | Source: https://github.com/bearBoy80/tauri/blob/v2/packages/plugins-workspace/plugins/notification/guest-js/index.ts#L190 |
interval | undefined | object | Source: https://github.com/bearBoy80/tauri/blob/v2/packages/plugins-workspace/plugins/notification/guest-js/index.ts#L183 |
static at( date, repeating, allowWhileIdle): Schedule| Parameter | Type | Default value |
|---|---|---|
date | Date | undefined |
repeating | boolean | false |
allowWhileIdle | boolean | false |
static every( kind, count, allowWhileIdle): Schedule| Parameter | Type | Default value |
|---|---|---|
kind | ScheduleEvery | undefined |
count | number | undefined |
allowWhileIdle | boolean | false |
static interval(interval, allowWhileIdle): Schedule| Parameter | Type | Default value |
|---|---|---|
interval | ScheduleInterval | undefined |
allowWhileIdle | boolean | false |
Attachment of a notification.
| Property | Type | Description | Defined in |
|---|---|---|---|
id | string | Attachment identifier. | Source: https://github.com/bearBoy80/tauri/blob/v2/packages/plugins-workspace/plugins/notification/guest-js/index.ts#L235 |
url | string | Attachment URL. Accepts the asset and file protocols. | Source: https://github.com/bearBoy80/tauri/blob/v2/packages/plugins-workspace/plugins/notification/guest-js/index.ts#L237 |
Options to send a notification.
2.0.0
type PermissionState: "granted" | "denied" | "prompt" | "prompt-with-rationale";Source: undefined
function active(): Promise<ActiveNotification[]>Retrieves the list of active notifications.
A promise resolving to the list of active notifications.
import { active } from '@tauri-apps/plugin-notification';const activeNotifications = await active();2.0.0
function cancel(notifications): Promise<void>Cancels the pending notifications with the given list of identifiers.
| Parameter | Type |
|---|---|
notifications | number[] |
Promise<void>
A promise indicating the success or failure of the operation.
import { cancel } from '@tauri-apps/plugin-notification';await cancel([-34234, 23432, 4311]);2.0.0
function cancelAll(): Promise<void>Cancels all pending notifications.
Promise<void>
A promise indicating the success or failure of the operation.
import { cancelAll } from '@tauri-apps/plugin-notification';await cancelAll();2.0.0
function channels(): Promise<Channel[]>Retrieves the list of notification channels.
A promise resolving to the list of notification channels.
import { channels } from '@tauri-apps/plugin-notification';const notificationChannels = await channels();2.0.0
function createChannel(channel): Promise<void>Creates a notification channel.
| Parameter | Type |
|---|---|
channel | Channel |
Promise<void>
A promise indicating the success or failure of the operation.
import { createChannel, Importance, Visibility } from '@tauri-apps/plugin-notification';await createChannel({ id: 'new-messages', name: 'New Messages', lights: true, vibration: true, importance: Importance.Default, visibility: Visibility.Private});2.0.0
function isPermissionGranted(): Promise<boolean>Checks if the permission to send notifications is granted.
Promise<boolean>
import { isPermissionGranted } from '@tauri-apps/plugin-notification';const permissionGranted = await isPermissionGranted();2.0.0
function onAction(cb): Promise<PluginListener>| Parameter | Type |
|---|---|
cb | (notification) => void |
Promise<PluginListener>
function onNotificationReceived(cb): Promise<PluginListener>| Parameter | Type |
|---|---|
cb | (notification) => void |
Promise<PluginListener>
function pending(): Promise<PendingNotification[]>Retrieves the list of pending notifications.
Promise<PendingNotification[]>
A promise resolving to the list of pending notifications.
import { pending } from '@tauri-apps/plugin-notification';const pendingNotifications = await pending();2.0.0
function registerActionTypes(types): Promise<void>Register actions that are performed when the user clicks on the notification.
| Parameter | Type |
|---|---|
types | ActionType[] |
Promise<void>
A promise indicating the success or failure of the operation.
import { registerActionTypes } from '@tauri-apps/plugin-notification';await registerActionTypes([{ id: 'tauri', actions: [{ id: 'my-action', title: 'Settings' }]}])2.0.0
function removeActive(notifications): Promise<void>Removes the active notifications with the given list of identifiers.
| Parameter | Type |
|---|---|
notifications | object[] |
Promise<void>
A promise indicating the success or failure of the operation.
import { cancel } from '@tauri-apps/plugin-notification';await cancel([-34234, 23432, 4311])2.0.0
function removeAllActive(): Promise<void>Removes all active notifications.
Promise<void>
A promise indicating the success or failure of the operation.
import { removeAllActive } from '@tauri-apps/plugin-notification';await removeAllActive()2.0.0
function removeChannel(id): Promise<void>Removes the channel with the given identifier.
| Parameter | Type |
|---|---|
id | string |
Promise<void>
A promise indicating the success or failure of the operation.
import { removeChannel } from '@tauri-apps/plugin-notification';await removeChannel();2.0.0
function requestPermission(): Promise<NotificationPermission>Requests the permission to send notifications.
Promise<NotificationPermission>
A promise resolving to whether the user granted the permission or not.
import { isPermissionGranted, requestPermission } from '@tauri-apps/plugin-notification';let permissionGranted = await isPermissionGranted();if (!permissionGranted) { const permission = await requestPermission(); permissionGranted = permission === 'granted';}2.0.0
function sendNotification(options): voidSends a notification to the user.
| Parameter | Type |
|---|---|
options | string | Options |
void
import { isPermissionGranted, requestPermission, sendNotification } from '@tauri-apps/plugin-notification';let permissionGranted = await isPermissionGranted();if (!permissionGranted) { const permission = await requestPermission(); permissionGranted = permission === 'granted';}if (permissionGranted) { sendNotification('Tauri is awesome!'); sendNotification({ title: 'TAURI', body: 'Tauri is awesome!' });}2.0.0
© 2025 Tauri Contributors. CC-BY / MIT