Skip to content

zxyao145/ByNotice

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

21 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

ByNotice

NuGet

This a notification razor component for blazor. It is written entirely in C# and CSS.

Sample https://zxyao145.github.io/ByNotice/.

Quick Start

  1. Add css to the html.
<link rel="stylesheet" href="/_content/ByNotice/bynotice.css" />
  1. Add namespace declaration in "_Imports.razor".
@using ByNotice
  1. Injection service
builder.Services.AddByNotice();
  1. Add component "Notice" in "MainLayout.razor" (or whatever you want to use).
<Notice />
  1. 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:

quickstart

See wiki or "ByNotice.Sample" for more usage.

Demo preview

default style:

default info

default-info

default success

default-success

default warning

default-warning

default error

default-error

default none icon

default-info

colorful:

colorful info

colorful-info

colorful success

colorful-success

colorful warning

colorful-warning

colorful error

colorful-error

custom width:

custom-width

custom icon:

custom-icon

emphasize

emphasize

OnClose Hook

OnClose Hook

Attention

Only one component instance is allowed in an application.

Developer

zxyao

License

MIT