Skip to main content

UI Development

Explore practical guides and implementation patterns for this topic.

Posts

Topic LWC
Lightning Web Components

Drag and Drop in LWC: HTML5 API, Kanban Boards & Reactive State Guide

In plain words: A Drag and Drop component in Lightning Web Components (LWC) allows users to click, grab, and move visual cards (such as tasks, leads, or opportunities) between different status columns or lists. By combining the native HTML5 Drag and Drop API with LWC reactive data arrays, you can build interactive Kanban boards and priority sorters that update Salesforce records in real time. Modern CRM users expect fluid, interactive interfaces to organize workloads quickly. Static picklist dropdowns and manual edit screens slow down sales reps and support agents when moving records through complex stages. Building a custom drag-and-drop experience in LWC allows teams to organize pipelines visually, reorder task queues, and trigger automated Apex DML updates or GraphQL mutations when cards are dropped.
Read article
Topic LWC
Lightning Web Components

Toast Notifications in LWC: ShowToastEvent, Variants & Message Links Guide

In plain words: A Toast Notification in Lightning Web Components (LWC) is a temporary popup banner that delivers instant visual feedback to users when an action completes—such as saving a record, triggering an error, or displaying a system warning. In Salesforce, toasts are dispatched directly from JavaScript using the ShowToastEvent module from lightning/platformShowToastEvent . Providing clear feedback is essential for building intuitive enterprise user interfaces. Instead of relying on static page text or intrusive browser alert boxes, Salesforce Lightning Experience provides built-in toast banners styled with the Salesforce Lightning Design System (SLDS). By firing custom toast events from your LWC JavaScript files, you can inform users about transaction outcomes, guide them through error resolutions, and link directly to newly created records.
Read article
Topic LWC
Lightning Web Components

Custom Field Validation in LWC: lightning-record-edit-form Best Practices

In plain words: The <lightning-record-edit-form> component in Lightning Web Components (LWC) provides built-in form handling, schema awareness, and database commits without custom Apex. By intercepting the form's onsubmit event in JavaScript, you can execute custom client-side validation rules, format input values, and stop invalid records from submitting before making a server roundtrip. Standard Salesforce page layouts automatically enforce required fields and validation rules, but custom business processes often demand dynamic client-side checks—such as cross-field dependency validation, regex pattern checks, or conditional data requirements. Building custom edit forms with <lightning-record-edit-form> and <lightning-input-field> allows developers to create tailored multi-column layouts while retaining full control over data submission and error handling.
Read article
Topic Apex Wire Service Lightning Datatable Lightning Web Components Salesforce Development Salesforce LWC UI Development
Apex Wire Service Lightning Datatable Lightning Web Components Salesforce Development Salesforce LWC UI Development

How to Build a Lightning Datatable in LWC: Step-by-Step Guide with Apex Wire Service

In plain words: The <lightning-datatable> is a built-in UI component in Salesforce Lightning Web Components (LWC) that lets you display rows of records in a structured grid with built-in column formatting, row actions, and sorting. Displaying tabular data efficiently is a core requirement for enterprise Salesforce applications. Using the base component <lightning-datatable> combined with Apex wire adapters delivers a responsive, standard-compliant UI that handles pagination, inline data formatting, and event actions with minimal custom CSS.
Read article
Topic LWC
Lightning Web Components

Reusable Pagination Component in LWC: Client vs. Server-Side Guide

In plain words: A Reusable Pagination Component in Lightning Web Components (LWC) is a standalone UI control that breaks down massive data lists into numbered pages. It calculates total pages dynamically based on record count, highlights the active page button, and communicates page changes to parent components using a standard JavaScript CustomEvent . Displaying hundreds of records at once on a Salesforce dashboard or custom table creates visual clutter and degrades browser rendering speeds. Rather than duplicating navigation buttons and page calculations across multiple custom components, creating a modular child pagination component ensures clean separation of concerns. The child component manages navigation state, while the parent handles data slicing and server-side queries.
Read article
Topic LWC
Lightning Web Components

Displaying FeedItem Images in Salesforce LWC: Custom Component Guide

In plain words: The Salesforce FeedItem object stores Chatter posts, links, and attachments. When building custom Lightning Web Components (LWC), you can query FeedItem records via Apex to extract image attachments or file references and render them directly onto record pages using standard HTML image tags. Salesforce Chatter provides robust collaboration features through objects like FeedItem and FeedAttachment . However, extracting and rendering images embedded within feed posts inside custom Lightning Web Components requires a combination of server-side Apex queries and client-side reactive property binding. Below is a complete guide to building a custom image-display component for FeedItems.
Read article
Topic LWC
Lightning Web Components

Building Dynamic Field Sets in Salesforce LWC: UI API & Schema Guide

In plain words: A Dynamic Field Set Component in Lightning Web Components (LWC) automatically renders form fields based on a Salesforce Field Set configuration rather than hardcoded HTML templates. By pairing the standard getObjectInfo wire adapter with <lightning-record-edit-form> , developers can build configurable forms that adapt instantly whenever administrators add or remove fields in Setup. Hardcoding input fields inside custom components creates rigid user interfaces that break whenever business requirements change. Salesforce Field Sets provide a declarative way to group fields for specific layouts or processes. Building a dynamic LWC component that consumes object metadata allows you to render fields dynamically, reducing code duplication and giving administrators control over form layouts.
Read article
Topic LWC
Lightning Web Components

Mastering List Iteration in Salesforce LWC: for:each Directive Guide

In plain words: List Iteration in Lightning Web Components (LWC) allows you to render collections of data dynamically in your HTML templates using the for:each directive. By looping through arrays of strings, numbers, or sObjects, you can build flexible, reusable UI lists and tables that update automatically when component state changes. Building dynamic user interfaces in Salesforce often requires rendering lists of records—such as account search results, related contacts, or task items. Lightning Web Components simplifies this process using template directives like for:each and iterator:it . Mastering list iteration is an essential step for every LWC developer.
Read article
Topic LWC
Lightning Web Components

Building a Reusable Paginator in Salesforce LWC: Complete Component Guide

In plain words: A Paginator Component in Lightning Web Components (LWC) is a modular navigation control that splits large lists of records into manageable pages. It provides intuitive navigation buttons (First, Previous, Next, Last) and informs the parent component of page selections via standard JavaScript CustomEvent dispatches. Displaying hundreds of records at once on a Salesforce page slows down browser performance and overwhelms users. A dedicated child paginator component cleanly separates the user interface navigation controls from data retrieval logic, allowing you to reuse the exact same pagination toolbar across lists, data tables, and custom cards.
Read article
Topic LWC
Lightning Web Components

How to Build a Custom Image Slider Carousel in Salesforce LWC

In plain words: An Image Slider Carousel in LWC is an interactive UI component that displays a sequence of images or banners within a single contained space. Users navigate back and forth between slides using controls, while smooth CSS transforms shift the visible slide into view. Displaying rich media, product banners, or announcement graphics is a frequent requirement in custom Lightning apps, Experience Cloud portals, and dashboard homepages. While Salesforce offers the standard <lightning-carousel> base component, building a custom slider provides complete control over animation speed, transitions, custom navigation indicators, and responsive layouts.
Read article
Topic LWC
Lightning Web Components

How to View All Files and Attachments in Salesforce LWC: Step-by-Step Guide

In plain words: A Record File Viewer in LWC is a custom Lightning component that queries and displays all files, documents, and attachments linked to a specific Salesforce record. Instead of navigating through standard related lists, users get a consolidated grid where they can view file details, preview content, and open direct download links. Salesforce records frequently accumulate documents such as contracts, spec sheets, invoices, and images. While the standard "Files" related list provides basic table access, business users often need a responsive card view with direct preview and download actions. Building this in Lightning Web Components (LWC) with modern Salesforce Files architecture delivers a clean, responsive document gallery directly on the record page.
Read article
Topic LWC
Lightning Web Components

Building Real-Time Search in Salesforce LWC: Apex, Wire Adapters & Debouncing

In plain words: Real-time record search in Lightning Web Components (LWC) allows users to filter and display Salesforce data instantly as they type into an input field. By pairing reactive @wire adapters or imperative Apex calls with client-side debouncing , the component queries matching records without firing excessive server requests on every single keystroke. Search bars and auto-complete lookup inputs are essential building blocks of modern enterprise Salesforce applications. Building a performant search feature requires balancing two competing priorities: giving the user an instant, reactive experience while protecting your Salesforce org from governor limit bottlenecks and unnecessary Apex execution loops.
Read article
Topic LWC
Lightning Web Components

How to Build Custom Footer Buttons in Salesforce Screen Flows (LWC)

In plain words: By default, Salesforce Screen Flows use standard "Next," "Previous," and "Finish" buttons at the bottom of the screen. While functional, they limit your ability to trigger custom validations, call external APIs before navigating, or apply custom branding. By building a custom Lightning Web Component (LWC) footer, you can take total control over how and when users move through your Flow. Screen Flows are an incredible tool for guiding users through complex data entry processes. However, the out-of-the-box footer buttons are rigid. If you want to customize their labels dynamically, trigger custom Apex logic when a user clicks "Next," or align the styling with your company's brand, you need to step outside the standard declarative tools. In this guide, we will walk through how to build a custom LWC to replace standard Screen Flow footer buttons, allowing for ultimate flexibility.
Read article
Topic LWC
Lightning Web Components

How to Build a Modal Popup with an Overlay in Salesforce LWC

In plain words: A modal popup is a box that appears over your main screen, forcing the user to interact with it before they can return to the main page. In Salesforce Lightning Web Components (LWC), you can build a clean, custom modal using a simple combination of HTML for the structure, CSS for the dark background overlay, and a JavaScript boolean variable to control when it opens and closes. Modals are essential UI elements. Whether you need to ask a user to confirm a deletion, display a complex data entry form, or show a critical warning, a modal popup with a darkened background overlay focuses the user's attention exactly where you need it. In this guide, we will build a highly reusable, custom modal component from scratch and show you how to control it from a parent component.
Read article
Topic LWC
Lightning Web Components

How to Navigate from LWC to an Aura Component in Salesforce

In plain words: While Lightning Web Components (LWC) are the future of Salesforce development, you likely still have legacy Aura Components in your org. To make a seamless transition, your new LWCs must be able to route users to those existing Aura pages. By using the standard NavigationMixin service in LWC, you can easily open an Aura Component without writing hacky workarounds. In the past, developers often relied on firing custom events wrapped in Aura containers to navigate between frameworks. However, Salesforce has standardized this process using the lightning/navigation module. In this guide, we will walk through the exact steps to configure an Aura Component to accept incoming traffic, and write the LWC code required to send users there.
Read article
Topic LWC
Lightning Web Components

How to Build a Dynamic Vertical Navigation Bar in Salesforce LWC

In plain words: A dynamic vertical navigation bar is a side menu where the links (like "Home", "About", and "Contact") are not hardcoded into the HTML. Instead, they are defined in JavaScript as an array. This makes it incredibly easy to add, remove, or change menu items later without having to rewrite your HTML layout. In modern web applications, a clean, intuitive navigation menu is essential. By building a vertical navigation bar using Lightning Web Components (LWC), you can create a reusable sidebar menu that perfectly matches your company's branding. In this tutorial, we will build a dynamic sidebar menu using the LWC for:each directive to loop through a list of JavaScript objects.
Read article
Topic LWC
Lightning Web Components

How to Create a Sticky Header in Salesforce Lightning Web Components (LWC)

In plain words: A sticky header is a navigation bar or title block that stays locked to the top of the browser window when a user scrolls down a long page. In Salesforce Lightning Web Components (LWC), you don't need complex JavaScript window listeners to achieve this—modern CSS position: sticky handles it natively and smoothly. When building custom applications in Salesforce, users often have to scroll through dense pages filled with records, forms, and data tables. Keeping action buttons or titles visible at all times greatly improves usability and navigation. In this guide, we will build a reusable, dynamic sticky header component in Lightning Web Components (LWC) using clean HTML markup and CSS.
Read article
Topic LWC
Lightning Web Components

How to Build a Dynamic Shopping Cart in Salesforce Using LWC

In plain words: A dynamic shopping cart in Salesforce Lightning Web Components (LWC) is an interactive client-side UI component that automatically updates and displays a list of selected items in real-time using standard modern web technologies like HTML templates and reactive JavaScript properties. Lightning Web Components (LWC) provide a fast, standards-based way to build modern user experiences on the Salesforce platform. In this guide, you will learn how to create a responsive, reusable shopping cart component to render items dynamically.
Read article
Topic LWC
Lightning Web Components

How to Dynamically Style Salesforce LWC Datatables with Custom CSS

In plain words: Dynamic styling in an LWC datatable means altering cell colors, badges, and fonts based on each row's underlying record data (such as painting an Error row red or a Success row green) at runtime. Standard Salesforce Lightning Web Components isolate CSS using the Shadow DOM. To style tabular cells conditionally based on record values—like rendering status indicators, alerts, or audit badges—developers can map calculated CSS classes dynamically through JavaScript getters or custom data structures.
Read article
Topic LWC
Lightning Web Components

How to Dynamically Reset Form Input Fields in Salesforce LWC

In plain words: Resetting input fields dynamically in Lightning Web Components (LWC) means using JavaScript to select all form inputs in one step ( querySelectorAll ), clearing their values, wiping any custom errors, and resetting the underlying tracked component state without writing manual reset lines for every single field. Form handling is a core part of building enterprise Salesforce apps. As forms expand with dozens of fields—such as text inputs, comboboxes, and textareas—manually setting every variable to an empty string becomes repetitive and prone to bugs. Creating a reusable, dynamic reset pattern keeps your code clean, maintainable, and scalable.
Read article