Skip to content

sud.showToast ​

Displays a toast message. Call sud.hideToast to close it early.

javascript
sud.showToast(object);

Parameters ​

PropertyTypeRequiredDescription
titlestringYesText to display
iconstringNoIcon type; see the values below and set explicitly
imagestringNoLocal file path of a custom icon; takes precedence over icon
durationnumberNoDisplay duration in milliseconds; explicitly set a positive value
maskbooleanNoWhether to display a transparent overlay that blocks touch events from reaching the content beneath it; set explicitly
successfunctionNoCalled on success; no additional result fields
failfunctionNoCalled on failure; see the fields below
completefunctionNoCalled after success or failure, with no arguments

Valid icon Values ​

ValueDescription
successSuccess icon
errorError icon
loadingLoading icon
noneNo icon

Failure Callback Parameters ​

PropertyTypeDescription
errCodenumberError code
errMsgstringError description

Usage Notes ​

Confirm that the target app supports this UI feature before using it. Keep the message brief and explicitly set the icon, duration, and overlay. The success callback reports a successful display request, not that the toast has closed.

Example ​

javascript
sud.showToast({
  title: 'Saved',
  icon: 'success',
  duration: 2000,
  mask: false,
  fail(error) {
    console.error('Failed to show toast', error.errCode, error.errMsg);
  }
});