From 8b8271b0eab65bb85bbf8c3826a0766682b3c826 Mon Sep 17 00:00:00 2001 From: Conduitry Date: Thu, 29 Oct 2020 16:19:57 -0400 Subject: [PATCH] slightly rearrange $$slots section in API docs --- site/content/docs/02-template-syntax.md | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/site/content/docs/02-template-syntax.md b/site/content/docs/02-template-syntax.md index 72b654a5e3..119488aacc 100644 --- a/site/content/docs/02-template-syntax.md +++ b/site/content/docs/02-template-syntax.md @@ -1317,10 +1317,14 @@ Named slots allow consumers to target specific areas. They can also have fallbac ``` +#### [`$$slots`](slots_object) + --- `$$slots` is an object whose keys are the names of the slots passed into the component by the parent. If the parent does not pass in a slot with a particular name, that name will not be a present in `$$slots`. This allows components to render a slot (and other elements, like wrappers for styling) only if the parent provides it. +Note that explicitly passing in an empty named slot will add that slot's name to `$$slots`. For example, if a parent passes `
` to a child component, `$$slots.title` will be truthy within the child. + ```sv @@ -1338,8 +1342,6 @@ Named slots allow consumers to target specific areas. They can also have fallbac
``` -Note that explicitly passing in an empty named slot will add that slot's name to `$$slots`. For example, if a parent passes `
` to a child component, `$$slots.title` will be truthy within the child. - #### [``](slot_let) ---