From e3ae1814dc175f72ea3b0514c27ed4938d96ea5a Mon Sep 17 00:00:00 2001 From: Rich Harris Date: Tue, 3 Dec 2024 23:03:16 -0500 Subject: [PATCH] docs: tweak slot docs --- .../docs/99-legacy/20-legacy-slots.md | 28 +++++++++++-------- 1 file changed, 17 insertions(+), 11 deletions(-) diff --git a/documentation/docs/99-legacy/20-legacy-slots.md b/documentation/docs/99-legacy/20-legacy-slots.md index 5189f2017db8..3474782e93ae 100644 --- a/documentation/docs/99-legacy/20-legacy-slots.md +++ b/documentation/docs/99-legacy/20-legacy-slots.md @@ -74,39 +74,45 @@ If no slotted content is provided, a component can define fallback content by pu Slots can be rendered zero or more times and can pass values _back_ to the parent using props. The parent exposes the values to the slot template using the `let:` directive. -The usual shorthand rules apply — `let:item` is equivalent to `let:item={item}`, and `` is equivalent to ``. - ```svelte - +
    - {#each items as item} + {#each items as data}
  • - + +
  • {/each}
+``` - - -
{thing.text}
+```svelte + + + +
{processed.text}
``` +The usual shorthand rules apply — `let:item` is equivalent to `let:item={item}`, and `` is equivalent to ``. + Named slots can also expose values. The `let:` directive goes on the element with the `slot` attribute. ```svelte - +
    {#each items as item}
  • - +
  • {/each}
+``` - +```svelte +
{item.text}

Copyright (c) 2019 Svelte Industries