Toast
Shows brief feedback and can offer an action.
When to use
- Acknowledge a completed action or let the user undo it immediately.
Examples
Save feedback
Loading the example
<k:Button text="Save the note" press=".onSave"/>sap.ui.define(["sap/ui/core/mvc/Controller", "kor/ui/Toast"], (Controller, Toast) => Controller.extend("sample.SaveToast", {
onSave() {
Toast.show("Note saved");
}
}));Undo an archive
Loading the example
<k:Stack gap="8">
<k:Text text="{/status}"/>
<k:Button text="Archive order" press=".onArchive"/>
</k:Stack>sap.ui.define(["sap/ui/core/mvc/Controller", "kor/ui/Toast"], (Controller, Toast) => Controller.extend("sample.UndoToast", {
onArchive() {
const model = this.getView().getModel();
model.setProperty("/status", "Archived");
Toast.show("Order archived", {
actionText: "Undo",
action: () => model.setProperty("/status", "Active order")
});
}
}));API
Methods
| Name | Description |
|---|---|
show(title: string, options: ToastOptions = {}): void | Shows a notification and can attach an action button |
type ToastOptions = { text?: string; state?: string; duration?: number; actionText?: string; action?: () => void };