force:showToast

force:showToast Message Display In Multiple Lines In Salesforce Lightning Component

Lightning Component

Sharing is caring!

Hello guys, today in this post i am going to share a workaround for salesforce lightning force:showToast event to display toast message in multiple lines.

In javaScript string we can use /n escape characters for insert a newline in string. so i have used /n in ‘force:showToast’ event message(string type) attribute, like following code in lightning component javaScript controller :

but still getting no result. 🙁  [display in single line]

force:showToast

 

This event is handled by the one.app container. It’s supported in Lightning Experience, Salesforce app, and Lightning communities.

Solution/Workaround :

create a external CSS file with following code :

next upload this CSS file in static resource and reference in your lightning component using ltng:require tag.

Check Also : Alternate/Workaround for contains() function in aura:if Condition in Lightning Component
JavaScript Controller :

force:showToast

 

Happy Learning 🙂

Related Resource :

showToast Doc

 

Sharing is caring!

(Visited 513 times, 22 visits today)

One thought on “force:showToast Message Display In Multiple Lines In Salesforce Lightning Component

Leave a Reply