Ability to nest slots/parts #130
-
Hey, With the WA-Page component, the slots seem to be needed on the exact children level from the wa-page, I'm finding it a bit tricky to create web components for these, as they are always in their own tag, with the slots beneath Is it possible to allow nesting on the wa-page slots (search for immediate and children for the slot) e.g.
I do believe allowing children to also specify the part for the slot would resolve this, but i couldn't seem to be able to get it right? |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 5 replies
-
This is a platform limitation. Any slotted element must be a direct descendant of the host element. The reason for this is because you can technically attach a shadow root to any element, not just custom elements. Thus, if a slotted element were nested like so: <wa-page>
<div>
<span slot="main-header"></span>
</div>
</wa-page> It would technically belong to the In your case, could you apply the |
Beta Was this translation helpful? Give feedback.
This is a platform limitation. Any slotted element must be a direct descendant of the host element. The reason for this is because you can technically attach a shadow root to any element, not just custom elements.
Thus, if a slotted element were nested like so:
It would technically belong to the
<div>
, not<wa-page>
.In your case, could you apply the
slot
attribute directly on your own custom elements instead?