Vue/Svelte-like named slots #755
andrewcourtice
started this conversation in
Show and tell
Replies: 2 comments
-
Interesting solution! May I also add in this thread that in /* Example.solid */}
<solid:slot name="example" />
{/* ParentExample.solid */}
---
import Example from './Example.solid';
---
<Example>
<solid:fragment name="example">
<h1>Hello World</h1>
</solid:fragment>
</Example> There's also https://github.com/LXSMNSYC/solid-sfc#solidfragment-solidslot-and-solidchildren |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
For those interested, here is one method you can use to implement Vue/Svelte-like named slots in Solid with minimal effort (1 component + 1 directive):
Slot component for defining the named slot:
Slot directive for projecting content to the named slot (or default if no name is specified):
Usage in receiving component:
Usage in projecting component:
Beta Was this translation helpful? Give feedback.
All reactions