Toast
The toast component is like an alert box that is only shown for a couple of seconds when something happens.
Selector
smart-toast
Properties
animationAnimation
Sets or gets the animation mode. Animation is disabled when the property is set to 'none'
Default valueadvanced
appendToany
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.
autoCloseboolean
Sets or gets whether the toast will automatically close after duration equal to the autoCloseDelay property.
Default valuefalse
autoCloseDelaynumber
Sets or gets the duration after which the toast automatically closes (works only if the autoClose property is set to true).
Default value3000
autoOpenboolean
Sets whether the toast will open automatically immediately after widget's initialization.
Default valuefalse
disabledboolean
The user will not be able to interact with toast items when disabled is set to true.
Default valuefalse
iconClassstring
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).
Default value"null
itemClassstring
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).
Default value"null
itemTemplatestring
Sets custom item template.
Default value"null
localestring
Sets or gets the language. Used in conjunction with the property messages.
Default value"en
localizeFormatFunctionany
Callback, related to localization module.
messagesany
Sets or gets an object specifying strings used in the widget that can be localized. Used in conjunction with the property locale.
Default value
"en": {
"propertyUnknownType": "'{{name}}' property is with undefined 'type' member!",
"propertyInvalidValue": "Invalid '{{name}}' property value! Actual value: {{actualValue}}, Expected value: {{value}}!",
"propertyInvalidValueType": "Invalid '{{name}}' property value type! Actual type: {{actualType}}, Expected type: {{type}}!",
"elementNotInDOM": "Element does not exist in DOM! Please, add the element to the DOM, before invoking a method.",
"moduleUndefined": "Module is undefined.",
"missingReference": "{{elementType}}: Missing reference to {{files}}.",
"htmlTemplateNotSuported": "{{elementType}}: Browser doesn't support HTMLTemplate elements.",
"invalidTemplate": "{{elementType}}: '{{property}}' property accepts a string that must match the id of an HTMLTemplate element from the DOM."
}
modalboolean
In 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.
Default valuefalse
positionToastPosition
Sets the part of the browser window where the toast will be positioned. The position property is disregarded if appendTo or modal are set.
Default valuetop-right
readonlyboolean
If the element is readonly, users cannot interact with it.
Default valuefalse
showCloseButtonboolean
Sets or gets whether to show the toast item's close button.
Default valuefalse
themestring
Determines the theme. Theme defines the look of the element
Default value"
typeToastType
Sets speciffic CSS settings and icon to the toast items.
Default valueinfo
unfocusableboolean
If is set to true, the element cannot be focused.
Default valuefalse
valueany
Sets a text value to an toast item.
Default value
onclick((this: Window, ev: Event) => any) | null
This event is triggered when the toast item is clicked.
Arguments
evEvent
onclose((this: Window, ev: Event) => any) | null
This event is triggered when the toast item is closed.
Arguments
evEvent
onopen((this: Window, ev: Event) => any) | null
This event is triggered when the toast item is opened.
Arguments
evEvent
onswipebottom((this: Window, ev: Event) => any) | null
This event is triggered on swipebottom over an toast item.
Arguments
evEvent
onswipeleft((this: Window, ev: Event) => any) | null
This event is triggered on swipeleft over an toast item.
Arguments
evEvent
onswiperight((this: Window, ev: Event) => any) | null
This event is triggered on swiperight over an toast item.
Arguments
evEvent
onswipetop((this: Window, ev: Event) => any) | null
This event is triggered on swipetop over an toast item.
Arguments
evEvent
Methods
closeAll(): void
Closes all opened toast items.
closeItem( item: HTMLElement | string): void
Closes particular toast item.
Arguments
itemHTMLElement | string
The toast item (or its id) to remove.
closeLast(): void
Closes the last opened toast item.
open(): HTMLElement
Opens a new toast item and returns the opened smart-toast-item instance.
ReturnsHTMLElement