Skip to main content

HTML Slots

Explore practical guides and implementation patterns for this topic.

Posts

Topic LWC
Lightning Web Components

How to Compose Salesforce LWCs: HTML Slots vs. Data Properties

In plain words: "Component composition" is just a fancy term for building a large webpage by snapping smaller, reusable pieces (components) together like Lego bricks. In Salesforce LWC, there are two main ways a parent component can give information to a child component: passing raw HTML layout using Slots , or passing actual data values using Properties . In Salesforce Lightning Web Components (LWC), building reusable user interfaces requires a solid understanding of how components interact. If you want a parent component to control what happens inside a child component, you have to choose the right tool for the job. Let's explore the two primary methods for composing components—HTML Slots and Data Properties—and look at the code required to implement them.
Read article