A succinct message that is displayed temporarily.
Installation
Run the following command:
Register a ToastManager for each user.
builder.Services.AddRazorComponents().AddInteractiveServerComponents();
builder.Services.AddScoped<ToastManager>();With a .Client project (WebAssembly or Auto), register it in both projects' Program.cs.
Add the Toaster component.
@inherits LayoutComponentBase
<main>@Body</main>
<Toaster />
The layout has to be interactive. If only your pages have a render mode, give the Toaster one:
<Toaster @rendermode="InteractiveAuto" />. See Render Modes.
Usage
Inject the ToastManager and add toasts to it. The Toaster in your layout shows them.
@inject ToastManager Toasts
<Button @onclick="Notify">Show Toast</Button>
@code {
private void Notify() =>
Toasts.Add(new ToastOptions
{
Title = "Event created",
Description = "Sunday, December 3 at 9:00 AM",
});
}Types
Set the Type option to render a status icon. The built-in renderer recognizes success, info, warning, error, and loading.
Action
Set ActionLabel and OnAction to render an action button. The toast closes after the action runs.
Toasts.Add(new ToastOptions
{
Title = "Event created",
ActionLabel = "Undo",
OnAction = UndoAsync,
});Promise
Use ToastManager.Promise to update one toast as an asynchronous task moves through loading, success, and error states.
API Reference
Toast
Other attributes are passed to the element it renders.
ToastAction
Other attributes are passed to the element it renders.
ToastClose
Other attributes are passed to the element it renders.
ToastContent
Other attributes are passed to the element it renders.
ToastDescription
Other attributes are passed to the element it renders.
ToastIcon
ToastPortal
ToastProvider
ToastTitle
Other attributes are passed to the element it renders.
ToastViewport
Other attributes are passed to the element it renders.
Toaster
Changelog
2026-11-24 ToastIcon type
ToastIcon's Type is now a ToastIconType: ToastIconType.Success,
Info, Warning, Error, or Loading. ToastOptions.Type still takes a
string, so Type = "success" keeps working.
<ToastIcon Type="ToastIconType.Success" />
If you render ToastIcon yourself, run dnx Blazix.Cli diff toast to see your changes, then
dnx Blazix.Cli add toast --overwrite.