ToastRack

Delightful toast notifications for Blazor

ToastRack is a lightweight, dependency-free toast notification library for Blazor WebAssembly and Blazor Server, supporting .NET 8, 9 and 10. It offers six stacking positions, loading and progress toasts, action buttons and full CSS theming — with accessibility built in and no JavaScript packages to install.

dotnet add package ToastRack

Features

  • Lightweight & dependency-free — no icon fonts, no JS libraries, no CSS frameworks. One NuGet package with a thread-safe service that works in WebAssembly and Server.
  • Loading & progress toasts — indeterminate spinner or a determinate progress circle, resolved in place into a success, error, warning or info toast when the work finishes.
  • Action buttons — undo, retry or any custom action. Toasts with actions never auto-expire, so users always have time to respond.
  • Six positions plus a boundary — all four corners plus top and bottom center, anchored to the viewport or to any element of your app via a ResizeObserver-tracked boundary.
  • Themable end to end — every color, size, radius and font is a --toastrack-* CSS custom property with a sensible default.
  • Custom content — swap the icon or replace the whole toast body with any RenderFragment.
  • Accessible by defaultrole="status" / role="alert", progressbar ARIA attributes and prefers-reduced-motion support out of the box.
  • Considerate timing — hovering a toast pauses its expiry timer, duplicate ids are deduplicated, and everything can be removed programmatically.

Quick start

Three steps and you are showing toasts in your Blazor app.

  1. Register the service in Program.cs: builder.Services.AddToastRack();
  2. Place <ToastRack /> once in your layout, e.g. MainLayout.razor.
  3. Inject IToastService and call Toasts.Success("Saved", "Your changes were saved successfully."); from anywhere.

Interactive demos

The live demo drives every feature in the browser: toast variants, six stacking positions, rack-level defaults, action buttons, the loading → progress → resolve flow, custom icons and fragments, deduplication, content-area boundaries, theming and a playground that generates the exact C# for the toast you compose.

Links

Loading the interactive demo…

An unhandled error has occurred. Reload 🗙