Alerts can be triggered from code and disappear after the specified duration.
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);
}
}