Lightning Web Component Slots in App Builder

Need some help, not even sure if this is possible…

In Lightning App Builder, the standard tabs component has “Slots” where tab content can be placed.

My question, is this available for LWC through slots?

I have tried adding <slot><slot> to a component and tried dragging other components into it in the Builder, the UI does not allow this action though.

Answer

I’m using the Experience Builder for an LWR site, and this seems to be working. Create a named slot in your HTML:

<slot name="content"></slot>

Then declare it in your JS using JSDoc syntax (The comments here are actually important):

/**

 * @slot content This is the main content slot

 */

export default class MyExample extends LightningElement { }

More information on slots in LWR sites:

https://developer.salesforce.com/docs/atlas.en-us.exp_cloud_lwr.meta/exp_cloud_lwr/get_started_layout.htm

Attribution
Source : Link , Question Author : Tiaan Swart , Answer Author : Brandon

Leave a Comment