Toast Notifications

Imperative toast system with auto-dismiss, stacking, and full ARIA accessibility.

Setup

// Program.cs
builder.Services.AddScoped<ToastService>();
// MainLayout.razor
<HelixToastContainer Position="ToastPosition.TopRight" />

Show Toasts

@inject ToastService ToastService

ToastService.ShowInfo("Processing...");
ToastService.ShowSuccess("File uploaded!");
ToastService.ShowWarning("Storage almost full.");
ToastService.ShowError("Connection lost.");

// With title
ToastService.ShowSuccess("Your changes were saved.", "Saved!");

// Custom duration (0 = no auto-dismiss)
ToastService.ShowError("Critical error", duration: 0);

Dismiss

var id = ToastService.ShowInfo("Processing...");
ToastService.Dismiss(id);      // Dismiss one
ToastService.DismissAll();     // Clear all

Parameters

ParameterTypeDefaultDescription
PositionToastPositionTopRightScreen position
MaxVisibleint5Max toasts before oldest dismissed

Live Demo

Toast Notifications Demo Open in new tab ↗
Loading Blazor demo...