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

Named slots do not work for components #3004

Closed
tonykiselis opened this issue Jun 10, 2019 · 2 comments
Closed

Named slots do not work for components #3004

tonykiselis opened this issue Jun 10, 2019 · 2 comments

Comments

@tonykiselis
Copy link

Just as an example:
https://svelte.dev/repl/45154c3f669543b39e1515d6bfe7fa14?version=3.5.1

The compiler throws some really weird error, which doesn't make much logical sense. It seems that the use case was simply forgotten from what it looks like:

Module build failed (from ./node_modules/svelte-loader/index.js):
Error: ValidationError: 'slot' is reserved for future use in named slots (20:18)
18: <header>
19:     <Navbar {classNames}>
20:         <NavBrand slot="nav-brand" />
                      ^
21:     </Navbar>
22: </header>

Well, I am using it in named slot. The warning I suppose was intended to prevent people using slot as a prop name for component.

Um.. well slots are in the compiler now. They just don't work on components. Documentation doesn't seem to mention this as far as I've checked.

There is obviously a few poor man's workarounds like wrapping components in html elements - bad, because it throws off styling and makes working with css frameworks difficult.

Another one is to use svelte:component directive, but this prevents passing props.

@pngwn
Copy link
Member

pngwn commented Jun 10, 2019

Named slotted components aren't implemented yet. We reserved the prop so that implementing them wouldn't be a breaking change.

@Conduitry
Copy link
Member

Duplicate of #1037.

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