pureblazor logo

Alerts

render modes
  • server
  • webassembly

Alerts can be triggered from code and disappear after the specified duration.


Usage

The AlertService triggers notifications to be displayed on top of the current page. To use the AlertService, add the <PureAlertProvider/> component to your page.

<PureButton OnClick="() => AddAlert(Success)">Success</PureButton>
<PureAlertProvider />
@code {
    [Inject]
    public AlertService Service { get; set; }
    public async Task AddAlert(Accent state)
    {
        await Service.ShowAsync("Adding your alert...", state);
    }
}

Basic alerts

Account information updated.
Your session will end in five minutes.
Watch for gators.
Background job failed. View details

Demo