<!--Basic Toast--><ui5-buttonid="wcBtnShowToastBasic"class="samples-margin">Basic Toast</ui5-button><ui5-toastid="wcToastBasic">Basic Toast</ui5-toast><script>// Attaching click listener to the Button which shows the Basic ToastwcBtnShowToastBasic.addEventListener('click',function(){wcToastBasic.show();});</script>
Toast Duration
Short ToastShort ToastLong ToastLong Toast
<!--Short Toast--><ui5-buttonid="wcBtnShowToastShort"class="samples-margin">Short Toast</ui5-button><ui5-toastid="wcToastShort"duration=1500placement="BottomStart">Short Toast</ui5-toast><!--Long Toast--><ui5-buttonid="wcBtnShowToastLong"class="samples-margin">Long Toast</ui5-button><ui5-toastid="wcToastLong"duration=4500placement="BottomEnd">Long Toast</ui5-toast><script>// Attaching click listener to the Button which shows the Short ToastwcBtnShowToastShort.addEventListener('click',function(){wcToastShort.show();});// Attaching click listener to the Button which shows the Long ToastwcBtnShowToastLong.addEventListener('click',function(){wcToastLong.show();});</script>
<!--TopStart--><ui5-buttonid="wcBtnShowToastTS">TopStart</ui5-button><ui5-toastid="wcToastTS"placement="TopStart">TopStart</ui5-toast><!--TopCenter--><ui5-buttonid="wcBtnShowToastTC">TopCenter</ui5-button><ui5-toastid="wcToastTC"placement="TopCenter">TopCenter</ui5-toast><!--TopEnd--><ui5-buttonid="wcBtnShowToastTE">TopEnd</ui5-button><ui5-toastid="wcToastTE"placement="TopEnd">TopEnd</ui5-toast><!--MiddleStart--><ui5-buttonid="wcBtnShowToastMS">MiddleStart</ui5-button><ui5-toastid="wcToastMS"placement="MiddleStart">MiddleStart</ui5-toast><!--MiddleCenter--><ui5-buttonid="wcBtnShowToastMC">MiddleCenter</ui5-button><ui5-toastid="wcToastMC"placement="MiddleCenter">MiddleCenter</ui5-toast><!--MiddleEnd--><ui5-buttonid="wcBtnShowToastME">MiddleEnd</ui5-button><ui5-toastid="wcToastME"placement="MiddleEnd">MiddleEnd</ui5-toast><!--BottomStart--><ui5-buttonid="wcBtnShowToastBS">BottomStart</ui5-button><ui5-toastid="wcToastBS"placement="BottomStart">BottomStart</ui5-toast><!--BottomCenter--><ui5-buttonid="wcBtnShowToastBC">BottomCenter</ui5-button><ui5-toastid="wcToastBC">BottomCenter</ui5-toast><!--BottomEnd--><ui5-buttonid="wcBtnShowToastBE">BottomEnd</ui5-button><ui5-toastid="wcToastBE"placement="BottomEnd">BottomEnd</ui5-toast><script>// Attaching click listeners to the buttons which show the toastsArray.from(document.querySelectorAll("ui5-button")).forEach(button=>{button.addEventListener('click',function(){document.querySelector("#"+button.id.replace("BtnShow","")).show();});});</script>
Overview
The ui5-toast is a small, non-disruptive popup for success or information messages that disappears automatically after a few seconds.
Usage
When to use:
You want to display a short success or information message.
You do not want to interrupt users while they are performing an action.
You want to confirm a successful action.
When not to use:
You want to display error or warning message.
You want to interrupt users while they are performing an action.
You want to make sure that users read the message before they leave the page.
You want users to be able to copy some part of the message text.
ES6 Module Import
import "@ui5/webcomponents/dist/Toast";
Properties/Attributes
You can use both properties and attributes with the same effect. The name of each attribute is listed below the name of the property, if different.
Name
Type
Default Value
Description
duration
Integer
3000
Defines the duration in milliseconds for which component remains on the screen before it's automatically closed.
Note: The minimum supported value is 500 ms and even if a lower value is set, the duration would remain 500 ms.
placement
ToastPlacement
"BottomCenter"
Defines the placement of the component.
Available options are:
TopStart
TopCenter
TopEnd
MiddleStart
MiddleCenter
MiddleEnd
BottomStart
BottomCenter
BottomEnd
Slots
This Element provides slot(s). This means it can display its child nodes.
Unless targeting the default slot, use the slot attribute to define the destination slot for each child.
Text, along with HTML Elements with no slot attribute, goes the the default slot.
Slot
Type
Description
default
Node [0..n]
Defines the text of the component.
Note: Although this slot accepts HTML Elements, it is strongly recommended that you only use text in order to preserve the intended design.
Methods
This Web Component exposes public methods. You can invoke them directly on the Web Component instance.
Name
Description
show
Shows the component.
Theme:Morning Horizon (Light)Evening Horizon (Dark)Horizon High Contrast BlackHorizon High Contrast WhiteQuartz LightQuartz DarkQuartz High Contrast BlackQuartz High Contrast White