DxToastProvider Class
A component that displays toast notifications.
Namespace: DevExpress.Blazor
Assembly: DevExpress.Blazor.v25.2.dll
NuGet Package: DevExpress.Blazor
Declaration
public class DxToastProvider :
DxComponentBase,
IDisposable
Remarks
The DxToastProvider component serves as a toast container and should be declared in the place where toasts will be displayed. Use the provider properties to define common toast settings.
Tip
Place DxToastProvider in the MainLayout.razor file when you need toast notifications throughout the app. This ensures a single, shared toast container is rendered on every page. Toasts created in code with IToastNotificationService appear regardless of the current page, and provider settings (position, width, display time) are applied consistently across the app.
<DxButton RenderStyle="ButtonRenderStyle.Secondary" Text="Show toast notification" Click="ShowToast" />
<DxButton RenderStyle="ButtonRenderStyle.Secondary" Text="Close toast notification" Click="CloseToast" />
<DxToastProvider
AnimationType="ToastAnimationType.Fade"
HorizontalAlignment="HorizontalAlignment.Left"
VerticalAlignment="VerticalEdge.Top"
RenderStyle="ToastRenderStyle.Success"
ThemeMode="ToastThemeMode.Saturated"/>
<DxToast @ref=toast
DisplayTime="@TimeSpan.Zero"
Title="Notification"
Text="The process is completed." />
@code {
DxToast toast;
private void ShowToast() {
toast.Show();
}
private void CloseToast() {
toast.Close();
}
}