0

Imagine you have a custom list:

<my-list>
    <my-heading>This is my List</my-heading>
    <my-item>Hello</my-item>
    <my-item>World</my-item>
</my-list>

In its shadow-dom, you have a slot where you want list items to be and a slot where you want the heading to be.

Right now I seem to not be able to find a solution that does not require me to explicitly reveal the way I implemented the shadow dom to the outside, especially: Anyone who wants to use "my-list" that isn't me needs to know how I called the slot:

<my-list>
    <my-heading slot="hdng">This is my List</my-heading>
    <my-item slot="itms">Hello</my-item>
    <my-item slot="itms">World</my-item>
</my-list>

What I would want to do is to obviously have the "user" of my custom element to just have to "use" the custom element and its children without having to specify anything else. Is there a way to imply the slot value a custom element has without having the user needing to know how it is called?

salbeira
  • 2,375
  • 5
  • 26
  • 40

0 Answers0