From 9a27617fd28dc5bc2462271737e7f8b8a891926e Mon Sep 17 00:00:00 2001 From: Cameron Messinides Date: Wed, 30 Sep 2020 16:48:23 -0400 Subject: [PATCH] docs: clarify omitted slot vs empty slot in $$slots --- site/content/docs/02-template-syntax.md | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/site/content/docs/02-template-syntax.md b/site/content/docs/02-template-syntax.md index e2d01bba89..202489df6c 100644 --- a/site/content/docs/02-template-syntax.md +++ b/site/content/docs/02-template-syntax.md @@ -1291,7 +1291,7 @@ Named slots allow consumers to target specific areas. They can also have fallbac --- -`$$slots` is an object whose keys are the names of the slots passed into the component by the parent. If the parent leaves a named slot empty, `$$slots` will not have a key for that slot. This allows components to render a slot (and other elements, like wrappers for styling) only if the parent provides children for it. +`$$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. ```sv @@ -1310,6 +1310,8 @@ 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) ---