New to sf development. Trying to understand how slots work. I did the basic hello world component tutorial and that works fine, but wanted to add some named slots to the component to see if I could drag other components in, but not seeing the slots show up in experience builder.
helloWorld.html
<template>
<lightning-card title="HelloWorld" icon-name="custom:custom14">
<div class="slds-m-around_medium">
<p>Hello, {greeting}!</p>
<lightning-input label="Name" value={greeting} onchange={changeHandler}></lightning-input>
</div>
<div>
<h2>Custom Slot</h2>
<div style="border: 1px solid black">
<slot></slot>
</div>
<div style="border: 1px solid black">
<slot name="slot1"></slot>
</div>
<div style="border: 1px solid black">
<slot name="slot2"></slot>
</div>
<div style="border: 1px solid black">
<slot name="slot3"></slot>
</div>
<div style="border: 1px solid black">
<slot name="slot4"></slot>
</div>
</div>
</lightning-card>
</template>
helloWorld.js
import { LightningElement } from 'lwc';
/**
* @slot default
* @slot slot1
* @slot slot2
* @slot slot3
* @slot slot4
*/
export default class HelloWorld extends LightningElement {
greeting = 'World';
changeHandler(event) {
this.greeting = event.target.value;
}
}
helloWorld.js-meta.xml
<?xml version="1.0" encoding="UTF-8"?>
<LightningComponentBundle xmlns="http://soap.sforce.com/2006/04/metadata" fqn="helloWorld">
<apiVersion>59.0</apiVersion>
<isExposed>true</isExposed>
<masterLabel>Hello World</masterLabel>
<targets>
<target>lightningCommunity__Page</target>
<target>lightningCommunity__Default</target>
</targets>
</LightningComponentBundle>
Any help is appreciated!