DedrisFrameworkDedrisFramework

← Plugins  /  Toast

🍞

Toast

cordova-plugin-x-toast
iOS Android

This community plugin shows a native "toast" — a small, non-blocking message that fades away on its own. It's the quickest way to confirm an action ("Saved!") without interrupting the user with a dialog they have to dismiss.

Installation

terminal
cordova plugin add cordova-plugin-x-toast

API

The plugin is exposed as window.plugins.toast after deviceready:

MethodDescription
show(message, duration, position, success, error)The flexible form. duration is "short" or "long"; position is "top", "center" or "bottom".
showShortTop / showShortCenter / showShortBottomShortcuts for a brief toast at a fixed position.
showLongTop / showLongCenter / showLongBottomShortcuts for a longer-lasting toast.
showWithOptions(options, success, error)Full control via an options object (message, duration, position, styling, addPixelsY).
hide()Dismiss the current toast immediately.

Usage example

Confirm a save with a short toast near the bottom of the screen:

www/js/app.js
function onSaved() {
  window.plugins.toast.showShortBottom("Saved!");
}

function onError() {
  window.plugins.toast.show("Something went wrong", "long", "center");
}

Tips

📚 Source: the technical reference on this page is based on the cordova-plugin-x-toast project (MIT licensed), maintained by the open-source community and listed in Ionic Native. Descriptions and examples have been rewritten in DedrisFramework's own words. This plugin is not part of the Apache Cordova core.
← Back to plugins Start a project