What is Lightning Notification Library in Salesforce
Learn all about Lightning's notification library in this blog. The notification library allows you to display messages in notes or toasts.
This component requires API version 41.0 or later.
You can display messages in notes and toasts. Notifications alert users to system-related issues and updates. Toasts can be used to provide feedback and act as a confirmation mechanism after a user performs an action.
Include one <lightning:notificationsLibrary aura:id="notifLib"/> tag in the component that triggers the notifications, where aura:id is a unique local ID. Only one tag is needed for multiple notifications.
Don't forget to check out: Life Cycle Hooks In Lightning Web Component | Salesforce Lightning
Notices
Tips interrupt the user's workflow and block everything else on the page. Notifications must be acknowledged before the user regains control of the app. So use hints sparingly. Not suitable for checking user actions. B. Before deleting the record. Only the OK button is currently supported to close the notification.
Tips inherit the style of prompts in the Lightning Design System.
To create and show a notification, use component.find('notifLib').showNotice() and pass the notification attributes. notifLib matches the aura:id of the Lightning:notificationsLibrary instance.
Toasts
Toasts are less intrusive than hints and are useful for providing feedback to the user after an action. B. After the record is created. Toasts can be discarded or left visible for a defined period of time.
Toast takes the style of toast in the Lightning Design System.
To create and display a toast, use component.find('notifLib').showToast() and pass the toast attributes. where notifLib matches the aura:id of the Lightning:notificationsLib component. seek
Here's an example that includes a button. When clicked, the button displays a toast with an information variant and remains visible until you click the close button indicated by an X in the upper right corner.
Check out another amazing blog by Mohit here: Learn About Lightning Design System in Salesforce
Responses