ToastService
This documentation provides a comprehensive reference for the
ToastService service, guiding you through its usage.Screenshot #

ToastService Methods #
| Name | Return type | Description | Added Version |
|---|---|---|---|
| Notify(ToastMessage toastMessage) | Void | Notifies subscribers of a new toast message event. | 1.0.0 |
| NotifyAsync(ToastMessage toastMessage) | Task | Notifies all subscribers of a new toast message event and awaits their completion. | 4.0.0 |
Usage Notes #
Use
Notify(...) for the common single Toasts host scenario.Use
await NotifyAsync(...) when multiple toast subscribers may be registered and the caller needs to await all handlers.ToastMessage Properties #
| Name | Type | Default | Required | Description | Added Version |
|---|---|---|---|---|---|
| AutoHide | bool | False | Gets or sets a value indicating whether the Toast should automatically hide. | 1.0.0 | |
| Content | RenderFragment? | null | Gets or sets the UI content to be rendered within the component. | 1.0.0 | |
| CustomIconName | string? | null | Specify custom icons of your own, like fontawesome. Example: 'fas fa-alarm-clock' | 1.0.0 | |
| HelpText | string? | null | Gets or sets the help text associated with this element. | 1.0.0 | |
| IconName | IconName | None | Gets or sets the icon to display for the associated element. | 1.0.0 | |
| Message | string? | null | Gets or sets the message content associated with this instance. | 1.0.0 | |
| Title | string? | null | Gets or sets the title associated with the object. | 1.0.0 | |
| Type | ToastType | Primary | Gets or sets the type of toast notification to display. | 1.0.0 |
ToastType Enum #
| Name | Value | Description | Added Version |
|---|---|---|---|
| Primary | 1 | Sets the primary background color to the toast. | 1.0.0 |
| Secondary | 2 | Sets the secondary background color to the toast. | 1.0.0 |
| Success | 3 | Sets the success background color to the toast. | 1.0.0 |
| Danger | 4 | Sets the danger background color to the toast. | 1.0.0 |
| Warning | 5 | Sets the warning background color to the toast. | 1.0.0 |
| Info | 6 | Sets the info background color to the toast. | 1.0.0 |
| Light | 7 | Sets the light background color to the toast. | 1.0.0 |
| Dark | 8 | Sets the dark background color to the toast. | 1.0.0 |