I wanted to wrap all slots of my custom component. But I couldn't iterate over the slots. My custom component usage looks like:
<Tab>
<span slot="header">Tab Header 1</span>
<span slot="header">Tab Header 2</span>
<span slot="header">Tab Header 3</span>
... maybe other slots that are not "header"
</Tab>
Then inside Tab.svelte:
{#each ?? as slot}
<a class="tab-item">
<each-slot />
</a>
{/each}
Above, I am trying to iterate over the children/slots named "header" and wrap them with an anchor tag. How can I do that?
Edit: I don't want to pass javascript objects like:
<Tab headers={['Header 1', 'Header 2', 'Header 3']}>