Loading...

Modern Salesforce applications frequently rely on popup modals for confirmations, warnings, access control decisions, and destructive actions. However, building modal logic separately inside every Lightning Web Component often leads to duplicated code, inconsistent user experiences, and growing technical debt. This blog introduces a flexible popup modal architecture in Lightning Web Components (LWC) that centralizes modal behavior into a reusable, configurable component.

By supporting dynamic headers, conditional content rendering, action-based events, and centralized state management, this approach enables teams to scale complex UI interactions without sacrificing maintainability or UX consistency. Whether you’re managing access permissions, confirmations, or multi-step workflows, this architecture provides a clean and future-proof solution for Salesforce developers.

Step-by-Step Guide to Build a Reusable Popup Modal Architecture in Salesforce LWC

This guide describes a flexible, reusable, and scalable popup modal architecture built using Lightning Web Components (LWC). The goal is to avoid hard-coding modal logic in every component and instead provide a generic modal component that can be configured and controlled by parent components.

This architecture supports:

  • Dynamic headers, body content, and footers
  • Conditional rendering (radio buttons, checkboxes, warnings, loaders)
  • Action-based communication between parent and modal
  • Centralized state handling
  • Clean separation of concerns

Step 1: Create a Grant Portal Access

Review the selected user’s details and current portal access status. This step provides visibility into existing invoice and admin permissions before initiating the group-level access grant.

pic 01 1

Step 2: Grant Access for Invoice or Admin

Choose the appropriate access level for the user by selecting either ‘Group Invoice Access’ or ‘Group Admin Access’ in the popup modal. Confirm your selection to grant permissions or cancel to exit without making changes.

pic 02 1

 

pic 03 1 1

Step 3: Access Grant for Group Invoice Access

Once confirmed, the system successfully grants Group Invoice Access to the user. A success notification is displayed, and the Current Access section is updated to reflect the newly assigned permissions.

IMAGEpic 04 1

Step 4: Remove the access

Click Remove Group Access to revoke the user’s group-level permissions. Confirm the action in the popup to remove access and update the user’s current access status accord

pic 05

pic 06

Step 5: By clicking the checkbox, we can disable the radio buttons:

When the checkbox is selected, the access-level radio buttons are automatically disabled to prevent selection.

pic 07 1

Source Code

Generic Pop up 

HTML

pic 08 1

pic 09 1

pic 10 1

JS

pic 11

pic 12

CSS

pic 13

pic 14

pic 15

pic 16

pic 17

pic 18

Pop up Parent Component

HTML

pic 19

pic 20

pic 21

JS

pic 22

pic 23

pic 24

pic 25

pic 26

CSS

pic 27

pic 28

pic 29

Watch Live Demo
https://hicdemo-dev-ed.my.salesforce-sites.com/GrantAcessPopupPortal

Conclusion

A flexible popup modal architecture in Lightning Web Components allows Salesforce teams to build reusable, scalable, and predictable UI interactions without duplicating logic across components. By separating modal structure, state, and event handling, this approach improves maintainability, enforces business rules, and ensures a consistent user experience across complex Salesforce applications.

At HIC Global Solutions, our Salesforce services focus on designing scalable LWC architectures, optimizing UI performance, and implementing enterprise-ready design patterns that grow with your business. Whether you’re modernizing existing components or building advanced Salesforce apps from scratch, our experts help you deliver clean, maintainable, and future-ready solutions.

No Data Found.

Related Articles
Dark Mode in Salesforce Enabling It and Creating Theme Ready Lightning Web Components with SLDS 2.0 1 1

With the Winter ’26 release, Salesforce introduced Dark Mode in Lightning Experience. Dark Mode has been introduced as a beta feature in Winter ’26, and at first it was available only for Starter Edition orgs. It is now rolling out further with Spring ’26 to Professional, Enterprise, and Developer editions. To use Dark Mode, Salesforce […]

Read More
How to Merge and Brand PDF Files in Salesforce Using LWC Visualforce PDF LIB 1

Salesforce developers frequently encounter document automation requirements that go beyond standard Apex-based PDF generation. From merging multiple ContentVersion files to dynamically applying branding like watermarks and headers, traditional server-side approaches often hit Salesforce heap size limits (6MB/12MB), creating performance and scalability challenges. This guide presents a heap-limit-safe PDF merging architecture in Salesforce using Lightning Web […]

Read More
How to Add a Lookup Recipient in a Sign Template

This step-by-step guide will provide you with quick steps on how to add a lookup recipient inside a sign template in just a few easy steps. This process improves your eSignature for Salesforce workflow by pulling recipients directly from related records. Whether you rely on Salesforce digital signature features or any eSignature integration, adding lookup […]

Read More
Agentforce VS code

As Salesforce continues to move toward AI-assisted development, Agentforce is emerging as a powerful tool that helps developers interact with their org metadata, objects, and configurations using intelligent prompts. When combined with Visual Studio Code (VS Code) and the Salesforce CLI, Agentforce enables a faster, more context-aware way to explore and build on the Salesforce […]

Read More
How to Send Your First Document for eSignature

Sending documents digitally is now a core requirement for modern businesses. With eSignature for Salesforce and seamless eSignature integration, users can configure and send documents for signing directly from Salesforce, eliminating manual paperwork and speeding up approvals while keeping all data centralized and secure. In this guide, we will provide you with quick steps to […]

Read More
How to Allow Standard Salesforce Users to Add or Remove Queue Members Securely

Managing Salesforce queues is typically restricted to system administrators, which often creates operational slowdowns for teams that need faster control over their assignments. When non-admin users must rely on admins for routine queue updates, productivity drops, and simple changes turn into avoidable delays. In this blog, we’ll walk through a practical workaround to this limitation […]

Read More
Our Location worldwide
Indian Flag India
3rd Floor, A-10, Pegasus Tower, Sector 68, Noida, Uttar Pradesh 201301 +91-1203239658
United States of America Flag USA
333 West Brown Deer Road Unit G – 366 Milwaukee WI, USA 53217 +1(262) 310-7818
United Kingdom Flag UK
7 Bell Yard, London, WC2A 2JR +44 20 3239 9428
Canada Canada
HIC Global Solutions INC
6D - 7398 Yonge St #1124 Thornhill, ON L4J 8J2 Canada +1(262) 310-7818