Toast message in Lightning component

How to show toast in lightning record page by using force:showToast. Toast are the message box or you can say notification which developer can show according to action of the user.

ATTRIBUTES

  1.  type :  The toast can be of 4 types
    •  info
    • success
    • warning
    • error
  2.  key :  It specify the icon on the toast when type is not defined.
  3. title : it specify the title of the toast
  4. message :  It specifies the message to show the user
  5. messageTemplate :  If we want to override the message which is specified in message attribute we can use this attribute along with messageTemplateData. 
  6. messageTemplateData : To show the overridden message you must use this attribute.
  7. duration : It specify the duration of toast to be show to user. After specified duration toast will automatically disappear.
  8.  mode : It specify how the toast will disappear. In salesforce there are 3 types of mode.
    • dismissible :  Toast will disappear either by user action or on complete of specified duration.
    • pester :  Toast will disappear on complete of specified duration. Close button will not appear.
    • sticky :  Toast will disappear  by user action

Permanent link to this article: https://salesforcebuddy.com/2020/04/toast-message-in-lightning-component/

Leave a Reply

Your email address will not be published.