Toast Blazor API

Toast Properties

NameTypeDefaultDescription
AppendTostring"null"Specifies the container where new openned toast items will be displayed. The value can be an HTMLElement or element's id. This property is in relation with modal(lower priority than modal) and position(higher priority than position) properties.
AutoCloseboolfalseSets or gets whether the toast will automatically close after duration equal to the autoCloseDelay property.
AutoCloseDelayint3000Sets or gets the duration after which the toast automatically closes (works only if the autoClose property is set to true).
AutoOpenboolfalseSets whether the toast will open automatically immediately after widget's initialization.
DisabledboolfalseThe user will not be able to interact with toast items when disabled is set to true.
IconClassstring"null"Sets custom icon className which overrides the default one. Multiple class names can be applied by separating them with a space. Useful when loading from a third-party icon library (such as Bootstrap).
ItemClassstring"null"Adds a custom class to Toast items. Multiple class names can be applied by separating them with a space. Useful when styling by using predefined class names from a third-party CSS library (such as Bootstrap).
ItemTemplatestring"null"Sets custom item template.
Localestring"en"Sets or gets the language. Used in conjunction with the property messages.
MessagesobjectN/ASets or gets an object specifying strings used in the widget that can be localized. Used in conjunction with the property locale.
ModalboolfalseIn modal mode the toast item is positioned in the center of the screen. This property is with higher priority than position and appendTo. If modal is set to true these properties are disregarded.
PositionToastPositionToastPosition.TopRightSets the part of the browser window where the toast will be positioned. The position property is disregarded if appendTo or modal are set.
ReadonlyboolfalseIf the element is readonly, users cannot interact with it.
RightToLeftboolfalseSets or gets the value indicating whether the element is aligned to support locales using right-to-left fonts.
ShowCloseButtonboolfalseSets or gets whether to show the toast item's close button.
Themestring""Determines the theme. Theme defines the look of the element
TypeToastTypeToastType.InfoSets speciffic CSS settings and icon to the toast items.
UnfocusableboolfalseIf is set to true, the element cannot be focused.
ValueobjectSets a text value to an toast item.

Toast Methods

NameTypeArgumentsDescription
CloseAllvoidN/ACloses all opened toast items.
CloseItemvoidobject itemCloses particular toast item.Args: object item - The toast item (or its id) to remove.
CloseLastvoidN/ACloses the last opened toast item.
GetValueAsync()Task<object>'N/A'Gets the &quot;Value&quot; property as Task&lt;object&gt;.
Openobjectobject value, string iconTypeOpens a new toast item and returns the opened smart-toast-item instance. Args: object value - The value for the toast item. If not set, the value property will be used.,string iconType - The icon name for the toast item. If not set, the type property determines the icon type that will be used.
OpenobjectN/AOpens a new toast item and returns the opened smart-toast-item instance.
Refreshvoid'N/A'Refreshes the Blazor Component. Performs a layout of the HTML Elements and recalculates the measurements.
Rendervoid'N/A'Re-renders the Blazor Component. This method will make a full re-render.
StateHasChangedvoid'N/A'Refreshes the state and Re-renders the Blazor Component, if necessary.

Toast Events

NameTypeDescriptionEvent Detail
OnItemClickEventCallback<Event>This event is triggered when the toast item is clicked.N/A
ItemClickedevent ToastItemClickedEventHandlerThis event is triggered when the toast item is clicked.ToastItemClickedEventArgs
OnCloseEventCallback<Event>This event is triggered when the toast item is closed.N/A
Closedevent ToastClosedEventHandlerThis event is triggered when the toast item is closed.ToastClosedEventArgs
OnOpenEventCallback<Event>This event is triggered when the toast item is opened.N/A
Openedevent ToastOpenedEventHandlerThis event is triggered when the toast item is opened.ToastOpenedEventArgs
OnSwipebottomEventCallback<Event>This event is triggered on swipebottom over an toast item.N/A
Swipebottomedevent ToastSwipebottomedEventHandlerThis event is triggered on swipebottom over an toast item.ToastSwipebottomedEventArgs
OnSwipeleftEventCallback<Event>This event is triggered on swipeleft over an toast item.N/A
SwipedLeftevent ToastSwipedLeftEventHandlerThis event is triggered on swipeleft over an toast item.ToastSwipedLeftEventArgs
OnSwiperightEventCallback<Event>This event is triggered on swiperight over an toast item.N/A
SwipeRightevent ToastSwipeRightEventHandlerThis event is triggered on swiperight over an toast item.ToastSwipeRightEventArgs
OnSwipetopEventCallback<Event>This event is triggered on swipetop over an toast item.N/A
Swipetopedevent ToastSwipetopedEventHandlerThis event is triggered on swipetop over an toast item.ToastSwipetopedEventArgs

Enums

ToastPosition

ToastPosition.TopLeft
ToastPosition.TopRight
ToastPosition.BottomLeft
ToastPosition.BottomRight

ToastType

ToastType.Info
ToastType.Warning
ToastType.Success
ToastType.Error
ToastType.Mail
ToastType.Time
ToastType.Null