Default Light
MgLibrary
Overview
Installation
Buttons
Cards
Charts
Codes
Data Grids
Dropdowns
Editors
Headers & Animations
Icons
Indicators
Inputs
Lists
Modals
Menus
Panels
Pills & Chips
Scheduling
Tabs
Time Line
Trees
Customization

Toasts

Lightweight, temporary notifications that appear at the edge of the screen to provide quick feedback.

Use this example to explore default behavior, customization points, and accessibility-friendly patterns in a real Blazor page.

API Reference

MgToastCollection

Property Type Default Description
Options MgToasterOptions new() Controls toast placement and lifetime for the rendered collection.

IToastService

Member Type Description
AddInfo(title, content) void Queues an informational toast.
AddDanger(title, content) void Queues an error toast.
AddWarning(title, content) void Queues a warning toast.
AddSuccess(title, content) void Queues a success toast.
AddInfoAsync(title, content) Task Asynchronously queues an informational toast.
AddDangerAsync(title, content) Task Asynchronously queues an error toast.
AddWarningAsync(title, content) Task Asynchronously queues a warning toast.
AddSuccessAsync(title, content) Task Asynchronously queues a success toast.
OnShowAlert event Action<MgEnums.MgToastType, string, string> Raised when a toast is requested.

MgToaster

Property Type Default Description
HeaderText string "" Toast heading text.
DisplayText string "" Toast message body.
ToastOptions MgToasterOptions new() Controls toast type and visible duration.
ToastId string Guid.NewGuid() Unique identifier for the toast instance.
An unhandled error has occurred. Reload 🗙