close

Filter

loading table of contents...

Studio Developer Manual / Version 2304

Table Of Contents

9.23.5 Displaying Toasts

Toasts provide feedback, which is triggered by user interaction. Toasts always appear at the bottom left of the screen and disappear automatically after six seconds, but can be disabled in the user preferences dialog. Unlike notifications, they can not be customized. A toast contains a title, a text and has one of the following states: INFO, SUCCESS, WARN or ERROR.

The given code example shows examples how the ToastManager can be used to display different types of toast messages.

import ToastsManager from "@coremedia/studio-client.ext.toast-components/ToastsManager";
import ValidationState from "@coremedia/studio-client.ext.ui-components/mixins/ValidationState";

//Example: information toast
ToastsManager.getInstance().showToastMessage("Hello", "This is a simple message.", null);

//Example: success toast
ToastsManager.getInstance().showToastMessage("Done!", "The job finished successfully.", ValidationState.SUCCESS);

//Example: warning toast
ToastsManager.getInstance().showToastMessage("Hint", "Maybe this will not work.", ValidationState.WARN);

//Example: error toast
ToastsManager.getInstance().showToastMessage("Ups", "Something went wrong.", ValidationState.ERROR);

Search Results

Table Of Contents
warning

Your Internet Explorer is no longer supported.

Please use Mozilla Firefox, Google Chrome, or Microsoft Edge.