Skip to main content

showToast

Description

Open a toast screen to display information to the user in a short period of time

Parameters

ParamData typeRequiredDescription
messagestringYesContent of the toast
positionstringYesThe toast display position, has one of two values "bottom" or "center"
iconUrlstringNoUrl to the icon displayed on the toast
buttonTextstringNoTitle of the button (when position is "bottom", Toast can have a button)
durationnumberNo (Default: 4)Toast auto-hidden time (in seconds)
onButtonClick() => anyNoThe action is triggered when the user press the button

Return Value

N/A

Error Code

N/A

Sample Code and Sample Return Data

Sample Request:

window.zlpSdk.UI
.showToast({ message: "Thao tác thành công", position: "center" })
.then((response) => console.log(response))
.catch((error) => console.error(error.errorCode));

Sample Response:

{ data: {}, status: "success" }