- This page is a stub and is waiting for contributions. Get involved by
+ This is a stub and is waiting for contributions. Get involved by
visiting us on GitHub or joining us on Discord.
diff --git a/src/content/docs/2/guide/notification.mdx b/src/content/docs/2/guide/notification.mdx
index 5fbcdf94ad..3c9885cd4a 100644
--- a/src/content/docs/2/guide/notification.mdx
+++ b/src/content/docs/2/guide/notification.mdx
@@ -1,10 +1,160 @@
---
-title: Notification
+title: Notifications
+description: Send native notifications to the user.
---
+import PluginBreadcrumb from '@components/PluginBreadcrumb.astro';
+import { Tabs, TabItem } from '@astrojs/starlight/components';
+import CommandTabs from '@components/CommandTabs.astro';
import Stub from '@components/Stub.astro';
-
- Based on
- https://github.com/tauri-apps/plugins-workspace/tree/v2/plugins/notification
-
+
+
+Send native notifications to your user using the notification plugin.
+
+## Setup
+
+Install the notifications plugin to get started.
+
+
+
+
+ 1. Use your project's package manager to add the dependency:
+
+
+
+ 2. Modify `lib.rs` to initialize the plugin:
+
+ {/* TODO: Revise once https://github.com/tauri-apps/tauri/issues/7696 is in */}
+
+ ```rust
+ #[cfg_attr(mobile, tauri::mobile_entry_point)]
+ pub fn run() {
+ tauri::Builder::default()
+ // Initialize the plugin
+ .plugin(tauri_plugin_notification::init())
+ .run(tauri::generate_context!())
+ .expect("error while running tauri application");
+ }
+ ```
+
+
+
+
+ 1. Run `cargo add tauri-plugin-notification` to add the plugin to the project's dependencies in `Cargo.toml`.
+
+ 2. Modify `lib.rs` to initialize the plugin:
+
+ ```rust
+ // lib.rs
+ #[cfg_attr(mobile, tauri::mobile_entry_point)]
+ pub fn run() {
+ tauri::Builder::default()
+ // Initialize the plugin
+ .plugin(tauri_plugin_notification::init())
+ .run(tauri::generate_context!())
+ .expect("error while running tauri application");
+ }
+ ```
+
+ 3. If you'd like to use notifications in JavaScript then install the npm package as well:
+
+
+
+
+
+
+
+## Usage
+
+Here are a few examples of how to use the notification plugin:
+
+- [Sent notification to users](#send-notification)
+- [Add an action to a notification](#actions)
+- [Add an attachment to a notification](#attachments)
+- [Send a notification in a specific channel](#channels)
+
+{/* TODO: Link to which language to use, frontend vs. backend guide when it's made */}
+
+The notification plugin is available in both JavaScript and Rust.
+
+### Send Notification
+
+{/* TODO: Demo component */}
+
+Follow these steps to send a notification:
+
+1. Check if permission is granted
+2. Request permission if not granted
+3. Send the notification
+
+
+
+
+```js
+import {
+ isPermissionGranted,
+ requestPermission,
+ sendNotification,
+} from '@tauri-apps/plugin-notification';
+
+// Do you have permission to send a notification?
+let permissionGranted = await isPermissionGranted();
+
+// If not we need to request it
+if (!permissionGranted) {
+ const permission = await requestPermission();
+ permissionGranted = permission === 'granted';
+}
+
+// Once permission has been granted we can send the notification
+if (permissionGranted) {
+ sendNotification({ title: 'Tauri', body: 'Tauri is awesome!' });
+}
+```
+
+
+
+
+{/* TODO: */}
+
+
+
+
+
+
+### Actions
+
+{/* TODO: */}
+
+
+
+### Attachments
+
+{/* TODO: */}
+
+
+
+### Channels
+
+{/* TODO: */}
+
+
+
+## Security Considerations
+
+Aside from normal sanitization procedures of user input there are currently no known security considerations.