Passing Snippets as Props
Accept snippet values as props to build highly flexible component APIs.
Snippet as a Prop
Snippets can be passed to child components like any other value.
Define and Pass
Define inline in the parent and reference by name.
{#snippet item(thing)}<li>{thing.name}</li>{/snippet}
<List itemSnippet={item} items={data} />All lessons in this course
- $props() for Typed Props
- {#snippet} and {@render}
- Passing Snippets as Props
- Default and Named Snippets