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 handled by the one.app container. It’s supported in Lightning Experience and Salesforce1 only. If used outside of Lightning Experience or Salesforce1, this event won’t be handled automatically. To use this event outside of one.app, create and wire up an event handler of your own.

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.