All Projects → Append-IT → Blazor.Notifications

Append-IT / Blazor.Notifications

Licence: MIT License
HTML5 Notifications API implementation for Microsoft Blazor

Programming Languages

C#
18002 projects
javascript
184084 projects - #8 most used programming language
HTML
75241 projects

Notifications

Implementation of the Notification API in C# for Microsoft Blazor.

Package Version NuGet Downloads License

Preview

Installation

Install-Package Append.Blazor.Notifications

Demo

There is a sample application in /docs folder which is also hosted as documentation.

For some other references of what the API does see the example demo

Usage

Add INotificationService via DI

Scoped by default.

public void ConfigureServices(IServiceCollection services)
{
    services.AddNotifications();
}

Inject into component/pages

@using Append.Blazor.Notifications
@inject INotificationService NotificationService

or

Inject on a BlazorComponent class:

[Inject] private INotificationService _notificationService { get; set; }

Browser Support

bool IsSupportedByBrowser = await NotificationService.IsSupportedByBrowserAsync()

Request Permission

PermissionType permission = await NotificationService.RequestPermissionAsync();

Check Notification Permission Status

PermissionType permission = NotificationService.PermissionStatus;

Create a notification

Using a Function (basic)

await NotificationService.CreateAsync("Title", "Description", "images/github.png");

Using NotificationOptions (advanced)

NotificationOptions options = new NotificationOptions
{
    Body = body,
    Icon = icon,
};

await NotificationService.CreateAsync(title, options);

Contributions and feedback

Please feel free to use the component, open issues, fix bugs or provide feedback.

Contributors

This project is created and maintained by:

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].