Studio Developer Manual / Version 2512.1
Table Of ContentsToasts 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 cannot 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 toastService can be used to display different types of toast messages.
import toastService from "@coremedia/studio-client.ext.toast-components/toastService";
import ValidationState from "@coremedia/studio-client.ext.ui-components/mixins/ValidationState";
//Example: information toast
toastService._.showToast("Hello", "This is a simple message.", null);
//Example: success toast
toastService._.showToast("Done!", "The job finished successfully.", ValidationState.SUCCESS);
//Example: warning toast
toastService._.showToast("Hint", "Maybe this will not work.", ValidationState.WARN);
//Example: error toast
toastService._.showToast("Ups", "Something went wrong.", ValidationState.ERROR);


