Hi Saddam,
Messages can be displayed in modals and popovers. Modals display a dialog in the foreground of the app, interrupting a user’s workflow and drawing attention to the message. Popovers display relevant information when you hover over a reference element.
Include one <lightning:overlayLibrary aura:id=”overlayLib”/> tag in the component that triggers the messages, where aura:id is a unique local ID. Only one tag is needed for multiple messages.
You can also refer
https://developer.salesforce.com/docs/component-library/bundle/lightning:overlayLibrary/documentation