Newer Version Available

This content describes an older version of this product. View Latest

force:showToast

Displays a message in a popup.

A toast displays a message below the header at the top of a view. The message is specified by the message attribute.

This example displays a toast message Success! The record has been updated successfully..

1showToast : function(component, event, helper) {
2    var toastEvent = $A.get("e.force:showToast");
3    toastEvent.setParams({
4        "title": "Success!",
5        "message": "The record has been updated successfully."
6    });
7    toastEvent.fire();
8}

This event is supported in Salesforce1 only. If used outside of Salesforce1, this event won’t be handled properly.

Note

Attribute Name Type Description
title String Specifies the title in bold for the toast.
message String Specifies the message to display.
key String Specifies an icon type.
duration Integer Toast duration in milliseconds. Default is 3000ms.