The solution is to create a custom CSS and use it in the component as shown below.
Component
1 2 3 4 5 6 7 8 9 10 11 12 13 14 | <aura:component implements="force:appHostable,flexipage:availableForAllPageTypes,flexipage:availableForRecordHome,force:hasRecordId,forceCommunity:availableForAllPageTypes,force:lightningQuickAction" access="global" > <!--Add this CSS below in your component--> <aura:html tag="style"> .toastMessage.forceActionsText{ white-space : pre-line !important; } </aura:html> <lightning:button label="Click Me !" iconName="utility:animal_and_nature" iconPosition="left" variant="brand" onclick="{! c.clickMe }" /> </aura:component> |
Controller
1 2 3 4 5 6 7 8 9 10 11 12 13 14 | ({ clickMe : function(component, event, helper) { var toastEvent = $A.get("e.force:showToast"); toastEvent.setParams({ title : 'Success', message: 'Hello !\nI am \nmulti line \ntoast. ', duration:' 5000', key: 'info_alt', type: 'success', mode: 'pester' }); toastEvent.fire(); } }) |
Please check below links also and subscribe if you like the content :
- How to secure your web to lead forms ?
- Lemonade Stand Application in Salesforce.
- How to send WhatsApp from Salesforce Lightning Component ?
- Use ZAPIER with Salesforce.
- Create Surveys in Salesforce.
- Line Clamp in Lightning Component.
- How to get Parent Id from encoded URL in Lightning Component ?
- How to add sorting in Lightning Data Table ?
- How to Send SMS from Salesforce ?
- How to Add Star Ratings in Salesforce ?
If you have any question please leave a comment below.
If you would like to add something to this post please leave a comment below.
Share this blog with your friends if you find it helpful somehow !
Thanks
Keep Coding 😊
0 Comments