Skip to content

Named slot interop with snippet prop + @render #13784

@brunnerh

Description

@brunnerh

Describe the bug

There were some interop limitations between slots & snippets which by now have been addressed for the most part, so this probably should be fixed as well, if possible.

Would obsolete #13063 since everything would be fully compatible as far as I can tell.

Reproduction

<h2>WithSnippet - Fragments</h2>
<WithSnippet>
	<svelte:fragment>
		Fragment content
	</svelte:fragment>
	<svelte:fragment slot="stuff">
		Fragment content
	</svelte:fragment>
</WithSnippet>

<h2>WithSnippet - Elements</h2>
<WithSnippet>
	<span>Element content</span>
	<span slot="stuff">
		Element content
	</span>
</WithSnippet>
<!-- WithSnippet.svelte -->
<script>
	const { stuff, children } = $props();
</script>

{#if children}
	<p>Default: {@render children()}</p>
{:else}
	<p style:color=red>Default slot snippet is undefined</p>
{/if}

{#if stuff}
	<p>Named: {@render stuff()}</p>
{:else}
	<p style:color=red>Named slot snippet is undefined</p>
{/if}

REPL

Logs

No response

System Info

REPL

Severity

blocking an upgrade

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions