Can you use named slots with components used via <svelte:component>? #12253
Unanswered
hopperelec
asked this question in
Q&A
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
I am making a layout which has several interchangeable "panes", similar to those you'd find in the Adobe or JetBrains suite. Every pane, along with the main content, has a "bar" which currently just shows the name of the pane and a minimize button. Because the panes are interchangeable, I use
<svelte:component>
for inserting the "main content" into this pane layout. However, I also want panes to be able to add content to the bar for changing view options.So, I have two separate slots which a pane should be able to add content to, which would be fine if I wasn't using
<svelte:component>
. Because I am using<svelte:component>
, though, there's no way for each pane to reference the named slots.I know I could just have two separate components, one for the "bar" slot and one for the "component" slot, but the bar and component are intended to be very tightly linked so managing communication between them is quite a hassle (I would know, because this is what I tried first). So, I would much prefer to define the "bar" and "component" slots within the same component, or to at least have one component within the other so I can just use bindings. Is this possible? And, if not, are there any alternative solutions I could consider?
Beta Was this translation helpful? Give feedback.
All reactions