Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Option to not make the named slot a child of a node #5303

Closed
TheComputerM opened this issue Aug 25, 2020 · 4 comments
Closed

Option to not make the named slot a child of a node #5303

TheComputerM opened this issue Aug 25, 2020 · 4 comments

Comments

@TheComputerM
Copy link

Is your feature request related to a problem? Please describe.
There should be some option to not bind the slot to any node:

<div class='test'><slot name="test" /></div>

and the input:

<p slot="test">Hello <b>World</b></p>

and the output is:

<div class='test'><p slot='test'>Hello <b>World</b></p></div>

But, there is no way to get something like this with using named slots:

<div class='test'>Hello <b>World</b></div>

Describe the solution you'd like
I would prefer for something like this:

<p slot="test" slot:node={false}>Hello World</p>

So the p element will not be added to the slot, but just the content.

How important is this feature to you?
Important, as this causes many problems with component composition and flexbox.

@TheComputerM
Copy link
Author

With this we can also do something like:

<div slot="test" slot:node={SvelteComponent}>
  This will be wrapped in `SvelteComponent`
</div>

@PatrickG
Copy link
Member

PatrickG commented Aug 25, 2020

There is a rfc and a pr that's waiting to be merged.

@TheComputerM
Copy link
Author

Does this mean the PR will be merged in the next minor version of svelte?

@Conduitry
Copy link
Member

No, but it means this is a duplicate of #2079.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants