Open
Description
Developers would like to be able to have dynamic <slot>
names:
<!-- x-slottable -->
<template>
<slot name={dynamic}></slot>
</template>
<!-- x-slotter -->
<template>
<x-slottable>
<div slot={dynamic}></slot>
</x-slottable>
</template>
This is currently disallowed by our compiler (Error: LWC1076: Name attribute on slot tag can't be an expression.
). But there's nothing in native shadow DOM that inherently disallows this; we could trivially require it there.
In fact, you can already achieve this in native shadow DOM by doing manual DOM manipulation, or cheating by using lwc:spread
.
One question is whether we'd want to support this in synthetic shadow DOM (probably not) or light DOM (maybe).