Activity Forums Salesforce® Discussions What is the use of notifilib in salesforce lightning component?

  • Deepak

    Member
    September 24, 2019 at 1:20 pm

    Messages can be displayed in notices and toasts. Notices alert users to system-related issues and updates. Toasts enable you to provide feedback and serve as a confirmation mechanism after the user takes 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.

    Notices
    Notices interrupt the user's workflow and block everything else on the page. Notices must be acknowledged before a user regains control over the app again. As such, use notices sparingly. They are not suitable for confirming a user’s action, such as before deleting a record. To dismiss the notice, only the OK button is currently supported.

    Notices inherit styling from prompts in the Lightning Design System.

    To create and display a notice, pass in the notice attributes using component.find('notifLib').showNotice(), where notifLib matches the aura:id on the lightning:notificationsLibrary instance.

    Here’s an example that contains a button. When clicked, the button displays a notice with the error variant.

    <aura:component>
    <lightning:notificationsLibrary aura:id="notifLib"/>
    <lightning:button name="notice" label="Show Notice" onclick="{!c.handleShowNotice}"/>
    </aura:component>

Log In to reply.

Popular Salesforce Blogs

Popular Salesforce Videos