ToastOptions Class
Defines options for a toast notification.
Namespace: DevExpress.Blazor
Assembly: DevExpress.Blazor.v25.1.dll
NuGet Package: DevExpress.Blazor
Declaration
public class ToastOptions
Remarks
The ToastOptions object allows you to set up toast settings when you create a toast notification at runtime.
<style>
.italic-text {
font-style: italic;
text-align: center;
}
</style>
<DxButton Text="Show a toast" Click="CreateToastAtRuntime" />
<DxToastProvider />
@code {
[Inject] IToastNotificationService ToastService { get; set; }
private void CreateToastAtRuntime() {
ToastService.ShowToast(new ToastOptions {
Title = "Notification",
Text = "The process is completed.",
ShowIcon = false,
CssClass = "italic-text",
ThemeMode = ToastThemeMode.Pastel,
ShowCloseButton = false,
});
}
}

Toast Position
ToastOptions does not set the toast position. To position toast notifications on the page at runtime, use one of the following approaches:
- Add multiple DxToastProvider components to the page, each with its own vertical and horizontal alignment.
Bind variables to VerticalAlignment and HorizontalAlignment properties of DxToastProvider and change them at runtime:
<DxToastProvider HorizontalAlignment="@CurrentHorizontalAlignment" VerticalAlignment="@CurrentVerticalAlignment" /> <DxButton Text="Display Toast" Click="OnClick" /> @code { HorizontalAlignment CurrentHorizontalAlignment { get; set; } = HorizontalAlignment.Right; VerticalEdge CurrentVerticalAlignment { get; set; } = VerticalEdge.Bottom; void OnClick() { CurrentHorizontalAlignment = HorizontalAlignment.Left; // Invoke toast display logic here } }
Inheritance
Object
ToastOptions
See Also