#12722·kit

Send snippets (that are not children) to +layout.svelte

Author: feuersteinerCreated Sep 26, 2024Updated Sep 27, 2026
Labelsload / layout

Describe the problem

I am creating a base page layout, that has different "slots", say a sidebar, a "main" content container, maybe a righthand sidebar ...

Content in these elements change frequently, hence the need to make sure that the layout is uniform for all of them.

one other reason that might be not relevant to everywhere, is that I need to initialize a canvas component in the layout and send some manager and some store downstream using the context API.

Describe the proposed solution

the ability for the layout page to receive multiple snippets:

javascript

<script>
    let {snippetA, snippetB} = $props();
</script>

<div>
{@render snippetA()}
</div>
<div>
the stuff I want to do
</div>
<div>
{@render snippetB()}
</div>

Alternatives considered

Currently the 2 things possible are:

  1. reverting back to using named slots
  2. only using children() snippet with layout.

Importance

would make my life easier

Additional Information

discord : https://discord.com/channels/457912077277855764/1288862792887308410