Skip to content

Ability to nest slots/parts #130

Jan 3, 2025 · 1 comments · 5 replies
Discussion options

You must be logged in to vote

Is it possible to allow nesting on the wa-page slots (search for immediate and children for the slot)

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 <div>, not <wa-page>.

In your case, could you apply the slot attribute directly on your own custom elements instead?

Replies: 1 comment 5 replies

Comment options

You must be logged in to vote
5 replies
@GedMarc
Comment options

@GedMarc
Comment options

@claviska
Comment options

@GedMarc
Comment options

@GedMarc
Comment options

Answer selected by GedMarc
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
2 participants