You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
github-actions[bot] edited this page Oct 31, 2025
·
1 revision
Show native desktop notifications with custom content and actions.
Overview
The Electron.Notification API provides the ability to show native desktop notifications with custom titles, bodies, icons, and actions. Notifications work across Windows, macOS, and Linux with platform-specific behavior.
Methods
🧊 Task<bool> IsSupportedAsync()
Check if desktop notifications are supported on the current platform.
Returns:
Whether or not desktop notifications are supported on the current system.
// Simple notificationElectron.Notification.Show(newNotificationOptions{Title="My Application",Body="This is a notification message",Icon="assets/notification-icon.png"});
Notification with Actions
// Notification with reply actionElectron.Notification.Show(newNotificationOptions{Title="New Message",Body="You have a new message from John",Icon="assets/message-icon.png",Actions=new[]{newNotificationAction{Text="Reply",Type=NotificationActionType.Button},newNotificationAction{Text="View",Type=NotificationActionType.Button}},OnClick=()=>OpenMessageWindow(),OnAction=(action)=>{if(action=="Reply"){ShowReplyDialog();}elseif(action=="View"){OpenMessageWindow();}}});
Rich Notifications
// Rich notification with all optionsElectron.Notification.Show(newNotificationOptions{Title="Download Complete",Subtitle="Your file has finished downloading",Body="document.pdf has been downloaded to your Downloads folder.",Icon="assets/download-icon.png",ImageUrl="file://"+Path.Combine(AppDomain.CurrentDomain.BaseDirectory,"assets/preview.png"),Sound=NotificationSound.Default,Urgency=NotificationUrgency.Normal,Category="transfer.complete",Tag="download-123",Actions=new[]{newNotificationAction{Text="Open",Type=NotificationActionType.Button},newNotificationAction{Text="Show in Folder",Type=NotificationActionType.Button}},OnShow=()=>Console.WriteLine("Notification shown"),OnClick=()=>OpenDownloadedFile(),OnClose=()=>Console.WriteLine("Notification closed"),OnAction=(action)=>{if(action=="Open"){OpenDownloadedFile();}elseif(action=="Show in Folder"){ShowInFolder();}}});
Platform-Specific Notifications
// Windows toast notificationif(RuntimeInformation.IsOSPlatform(OSPlatform.Windows)){Electron.Notification.Show(newNotificationOptions{Title="Background Task",Body="Your backup is complete",Icon="assets/app-icon.ico",Tag="backup-complete",RequireInteraction=true});}// macOS notification with soundelseif(RuntimeInformation.IsOSPlatform(OSPlatform.OSX)){Electron.Notification.Show(newNotificationOptions{Title="Alert",Body="Something needs your attention",Sound=NotificationSound.Default,Actions=new[]{newNotificationAction{Text="View",Type=NotificationActionType.Button}}});}
Notification Management
// Check notification supportvarisSupported=awaitElectron.Notification.IsSupportedAsync();Console.WriteLine($"Notifications supported: {isSupported}");// Create notification with eventsvarnotification=newNotificationOptions{Title="Task Complete",Body="Your long-running task has finished",OnShow=()=>Console.WriteLine("Notification displayed"),OnClick=()=>OpenTaskResults(),OnClose=()=>Console.WriteLine("Notification dismissed")};Electron.Notification.Show(notification);