How to create a timed fade out message using force:showToast

So this is pretty simple to create. I have the code:

showMessage : function(){
    var toastEvent = $A.get("e.force:showToast");
        mode : "dismissable",
        message : "My Message",
        type : "success",
        duration : 1000

The problem with this, is that the toast message that shows up disappears after 5 seconds when it should disappear after 1 second. The Salesforce documentation states that the duration has a default value of 5000 milliseconds (, but it does not let me enter a value lower than this. I am trying to find a workaround, or if anyone knows a way to get this to work. This would be extremely helpful.

(Seems I am not the only one looking for a solution –


The minimum value for duration is 5000ms. If you gave value less the 5000ms value will be taken as 5000ms.

enter image description here

Source : Link , Question Author : Nicolas O , Answer Author : Ajith Kumar

Leave a Comment