Skip to main content
All docs
V24.2

DevExpress v24.2 Update — Your Feedback Matters

Our What's New in v24.2 webpage includes product-specific surveys. Your response to our survey questions will help us measure product satisfaction for features released in this major update and help us refine our plans for our next major release.

Take the survey Not interested

ToastOptions.ShowIcon Property

Specifies whether to show an icon in the toast notification.

Namespace: DevExpress.Blazor

Assembly: DevExpress.Blazor.v24.2.dll

NuGet Package: DevExpress.Blazor

#Declaration

C#
[DefaultValue(null)]
public bool? ShowIcon { get; set; }

#Property Value

Type Default Description
Nullable<Boolean> null

true to show the icon; otherwise, false.

#Remarks

A toast notification displays a predefined icon. Set the ShowIcon property to false to hide the icon. If the ShowIcon property is not specified, icon visibility is determined by the DxToastProvider.ShowIcon property.

Use the IconCssClass property to customize icon settings or display a custom icon.

razor
<DxButton Text="Show a toast" Click="CreateToasts" />
<DxToastProvider ThemeMode="ToastThemeMode.Pastel" />

@code {
    [Inject] IToastNotificationService ToastService { get; set; }

    private void CreateToasts() {
        ToastService.ShowToast(new ToastOptions {
            Text = "Predefined icon.",
        });
        ToastService.ShowToast(new ToastOptions {
            Text = "Custom icon.",
            IconCssClass = "oi oi-task"
        });
        ToastService.ShowToast(new ToastOptions {
            Text = "No icon.",
            ShowIcon = false
        });
    }
}

Toasts with default and custom icons

See Also