This Lightning Web Component (LWC) provides a reusable modal window that can be easily integrated into Salesforce Lightning App Pages and Lightning Record Pages. The modal window allows you to display additional information or actions to users without navigating away from the current page.
- Click a button to open the modal window.
- Modal window includes a customizable header, content, and footer.
- Close the modal window using the close button or the provided "Close" button.
- Cross icon for closing the modal window in the header.(Optional)
- Fully customizable styling using Salesforce Lightning Design System (SLDS) classes.
- Suitable for various use cases where a modal dialog is required.
To use this Lightning Web Component in your Salesforce org, follow these steps:
-
Clone or Download this Repository:
- Clone this GitHub repository to your local machine using the following command:
git clone https://github.com/s4SHIVam7/Modal_window_lwc.git
- Clone this GitHub repository to your local machine using the following command:
-
Deploy the Lightning Web Component:
- Deploy the
modalWindow_lwc
Lightning Web Component to your Salesforce org.
- Deploy the
-
Customize the Modal Window:
- Modify the
modalWindow_lwc.html
as per your requirement.
- Modify the
-
Add the Component to Your Salesforce Page:
- Add the
modalWindow_lwc
component to your Lightning App or Record Page.
- Add the
-
Open a Salesforce Lightning Page or App:
- Navigate to a Salesforce Lightning Page or App where you've added the
modalWindow_lwc
component.
- Navigate to a Salesforce Lightning Page or App where you've added the
-
Click on Open Modal Button:
- Click on the Open Modal Button to display another window.
-
Click on Close Button:
- Click on the Close Button to dismiss the window.
You can customize the header, body, footer by modifying the modalWindow_lwc.html
.
<div class="slds-modal slds-fade-in-open" if:true={isModalOpen}>
<div class="slds-modal__container">
<header class="slds-modal__header">
<h2 class="slds-text-heading_medium">Salesforce LWC</h2>
</header>
<div class="slds-modal__content slds-p-around_medium">
<p>hi buddy, have a good day :) </p>
</div>
<footer class="slds-modal__footer">
<button class="slds-button slds-button_neutral" onclick={closeModal}>Close</button>
</footer>
</div>
</div>
For questions, support, or feedback, please feel free to reach out:
- Telegram: @shivam_l
- LinkedIn: Shivam Laidwar