Skip to main content

Posts

Showing posts from May, 2022

Custom Toast Message in LWC with custom duration

How to show custom Toast message in LWC and increase the duration or length of the time the toast is visible ? Show custom Toast message In Salesforce we have base component to show Toasts to the user. Toasts are used to provide feedbacks to user to show success or error messages of the action taken. For example after a record is updated or a new record is created.  Currently, in base component the toast remains visible to the user on the screen only for 3 seconds by default and user can configure it to dismiss it on click or a combination of both.  However, in LWC user cannot increase the duration of the toast to be visible to the user for more than the default time which is 3 seconds. In Aura Component  this is possible, a developer can configure the duration or length of the toast according to the requirement. What if we have a requirement to increase the duration and it is a LWC component ? In this post we will see how we can create a custom Toast component in LWC to configure th