# Notification
> The Notification component in Blazor allows you to inform users about relevant events. These visual alerts appear temporarily on the screen and can contain information about events, interactions, or important reminders.
Source page: https://doc.astrolui.com/basic-component/notification
## 1. Minimum notifications
In this example, [buttons](/basic-component/button) are implemented, so it is recommended to refer to their documentation.
```razor
@using Astrol.Entities.Basic.Static.Notification
@using Astrol.Component.Basic.Button
@using Astrol.Entities.Basic.UI
@using Astrol.JSInterop.Base
@inject AstrolJSInterop jsI
@code {
```
```csharp
private async Task ShowMinimalNotification() {
await Task.Delay(400);
await jsI.Notification("Minimum notification: Base".NotificationBase());
await Task.Delay(400);
await jsI.Notification("Minimum notification: None".NotificationNone());
await Task.Delay(400);
await jsI.Notification("Minimum notification: Info".NotificationInfo());
await Task.Delay(400);
await jsI.Notification("Minimum notification: Error".NotificationError());
await Task.Delay(400);
await jsI.Notification("Minimum notification: Warning".NotificationWarning());
await Task.Delay(400);
await jsI.Notification("Minimum notification: Success".NotificationSuccess());
}
}
```
Open all minimum notifications
## 2. Custom notifications
```razor
@using Astrol.Component.Basic.Button
@using Astrol.Entities.Basic.UI
@using Astrol.JSInterop.Base
@inject AstrolJSInterop jsI
@code {
```
```csharp
private async Task ShowNotification(string message,string icon, AstrolStyle type, bool outline = false) {
await jsI.Notification(new Notification
{
Type = type,
Icon = icon,
Message = message,
Outline = outline,
});
}
}
```
## 3. IAstrolToast / IAstrolModal
Recommended way: the **IAstrolToast** and **IAstrolModal** services are injected into any component, need no **@ref** and are rendered by Blazor.
```csharp
// Program.cs
using Astrol.Component.Basic;
builder.Services.AddAstrolBasic();
```
```razor
@using Astrol.Component.Basic.Toast
@using Astrol.Component.Basic.Modal
@inject IAstrolToast Toast
@inject IAstrolModal Modal
@* AstrolLayoutMenu already includes and *@
@code {
```
```csharp
private void Save() {
Toast.Success("Saved");
Toast.Error("Could not save\nPlease try again");
}
private async Task Delete() {
if (await Modal.ConfirmAsync("Are you sure?", "The item will be deleted."))
Toast.Success("Deleted");
}
private async Task Edit() {
// EditUser: your component; it closes itself with [CascadingParameter] AstrolModalReference
var result = await Modal.ShowAsync("Edit", new Dictionary { ["Id"] = 5 });
if (!result.Cancelled) { var user = result.GetData(); }
}
}
```
### Supported parameters
**IAstrolToast service (recommended)**: **@inject IAstrolToast Toast** and **Toast.Success / Error / Warning / Info("message", seconds)** (default 5 / 8 / 6 / 5 seconds), **Toast.Show("message", style, icon, seconds, outline)**, **Toast.Show(notification)** with the model below, or **Toast.Clear()**. It is rendered by Blazor, pauses on hover, can be closed with the keyboard, follows the theme and stays above modals. Requires **AddAstrolBasic()**; **AstrolLayoutMenu** already includes the host (without it, add **** once, e.g. in MainLayout; with no host the JS notification is used).
String extensions (**@using Astrol.Entities.Basic.Static.Notification**), for **jsI.Notification(...)** or **Toast.Show(...)**: **"text".NotificationSuccess()**, **NotificationError**, **NotificationWarning**, **NotificationInfo**, **NotificationNone** and **NotificationBase**, with optional parameters **(icon = "astrol-warning", outline = true, time = 5, allowHtml = false)**.
**Notification** model (also for **jsI.Notification(...)**):
- Message **(string)**, text to display. Line breaks **\n** are kept.
- AllowHtml **(bool)**, renders the message as HTML. **Default false** (plain text, prevents HTML injection); use it only with trusted content.
- Icon **(string)**, icon (default **astrol-warning ***).
- ShowLoad **(bool)**, lifetime bar (default **true**).
- Outline **(bool)**, style without fill (default **false**; **true** in the extensions).
- Time **(int)**, seconds visible (default **5**); with IAstrolToast, **0** = stays until closed (with jsI.Notification it closes immediately).
- Type **(AstrolStyle)**, color: Base, White, Black, Red, Orange, Green, Blue, Yellow, Purple.