Namespace sap.m.MessageToastModule: sap/m/MessageToast
A message toast notification offers simple feedback about an operation in a pop-up. Toasts automatically disappear after a timeout unless the user moves the mouse over the toast or taps on it. In this case the toast will remain on the screen and can be closed when the user moves the mouse out or taps out of the toast. Toasts appears close the bottom of the screen, centered horizontally, but you can change this position which is not dependent on the default values of the position settings. The default position applies as long as the application does not do any position setting. Position settings are "my", "at", "of" and "offset".
Beware that only one message toast can be shown at a time in the same place. If you want to have multiple message toasts visible at the same time, you need to position the message toasts in different places. This positioning needs to be handled in the application logic.
Message toast example:
sap.m.MessageToast.show("This message should appear in the message toast", { duration: 3000, // default width: "15em", // default my: "center bottom", // default at: "center bottom", // default of: window, // default offset: "0 0", // default collision: "fit fit" // default onClose: null, // default autoClose: true, // default animationTimingFunction: "ease", // default animationDuration: 1000, // default closeOnBrowserNavigation: true // default });
Since: 1.9.2.
The only mandatory parameter is sMessage
.
{string} | sMessage | The message to be displayed. |
{object} | mOptions? | Object which can contain all other options. Not all entries in this object are required. This property is optional. |
{int} | mOptions.duration?, Default: 3000 | Time in milliseconds before the close animation starts. Needs to be a finite positive nonzero integer. |
{sap.ui.core.CSSSize} | mOptions.width?, Default: '15em' | The width of the message toast, this value can be provided in %, em, px and all possible CSS measures. |
{sap.ui.core.Popup.Dock} | mOptions.my?, Default: 'center bottom' | Specifies which point of the message toast should be aligned. |
{sap.ui.core.Popup.Dock} | mOptions.at?, Default: 'center bottom' | Specifies the point of the reference element to which the message toast should be aligned. |
{sap.ui.core.Control|Element|jQuery|Window|undefined} | mOptions.of?, Default: window | Specifies the reference element to which the message toast should be aligned, by default it is aligned to the browser visual viewport. |
{string} | mOptions.offset?, Default: '0 0' | The offset relative to the docking point, specified as a string with space-separated pixel values (e.g. "0 10" to move the message toast 10 pixels to the right). |
{string} | mOptions.collision?, Default: 'fit fit' | Specifies how the position of the message toast should be adjusted in case it overflows the screen in some direction. Possible values “fit”, “flip”, “none”, or a pair for horizontal and vertical e.g. "fit flip”, "fit none". |
{function} | mOptions.onClose? | Function to be called when the message toast closes. |
{boolean} | mOptions.autoClose?, Default: true | Specify whether the message toast should close as soon as the end user touches the screen. |
{string} | mOptions.animationTimingFunction?, Default: 'ease' | Describes how the close animation will progress. Possible values "ease", "linear", "ease-in", "ease-out", "ease-in-out". This feature is not supported in android and ie9 browsers. |
{int} | mOptions.animationDuration?, Default: 1000 | Time in milliseconds that the close animation takes to complete. Needs to be a finite positive integer. For not animation set to 0. This feature is not supported in android and ie9 browsers. |
{boolean} | mOptions.closeOnBrowserNavigation?, Default: true | Specifies if the message toast closes on browser navigation. |