This a notification razor component for blazor. It is written entirely in C# and CSS.
Sample https://zxyao145.github.io/ByNotice/.
- Add css to the html.
<link rel="stylesheet" href="/_content/ByNotice/bynotice.css" />
- Add namespace declaration in "_Imports.razor".
@using ByNotice
- Injection service
builder.Services.AddByNotice();
- Add component "Notice" in "MainLayout.razor" (or whatever you want to use).
<Notice />
- notify a message
@inject NoticeService NoticeService
await NoticeService.NotifyAsync(new NoticeOption()
{
Message = "here is the message",
Title = "here is tite"
});
you can use NoticeService.NotifyInfoAsync
, NoticeService.NotifySuccessAsync
, NoticeService.NotifyWarningAsync
, NoticeService.NotifyErrorAsync
method too.
Oh, you should install it first. The Nuget path is here.
Install-Package ByNotice
Be careful: Notice.Instance is obsolete after version 0.2.0.
result:
See wiki or "ByNotice.Sample" for more usage.
default style:
default info
default success
default warning
default error
default none icon
colorful:
colorful info
colorful success
colorful warning
colorful error
custom width:
custom icon:
emphasize
OnClose Hook
Only one component instance is allowed in an application.
zxyao
MIT