From 6d37b7f80edbd67364486720525f7645119fb07f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jo=C3=A3o=20Paquim?= Date: Thu, 22 Jul 2021 15:02:29 +0100 Subject: [PATCH] docs: remove duplicate section describing slots (#820) With the recently added documentation describing named slots, the previous Slots section was redundant, and was consolidated into the same section. --- .../pages/core-concepts/astro-components.md | 32 ++----------------- 1 file changed, 2 insertions(+), 30 deletions(-) diff --git a/docs/src/pages/core-concepts/astro-components.md b/docs/src/pages/core-concepts/astro-components.md index 59c2de33f..5c20169da 100644 --- a/docs/src/pages/core-concepts/astro-components.md +++ b/docs/src/pages/core-concepts/astro-components.md @@ -196,6 +196,8 @@ const { greeting = 'Hello', name } = Astro.props; ``` +Note that if the `` tag is not used in the HTML template, any children passed to the component will not be rendered. + Slots become even more powerful when using **named slots**. Rather than a single `` element which renders _all_ children, named slots allow you to specify multiple places where children should be placed. > **Note:** The `slot` attribute is not restricted to plain HTML, components can use `slot` as well! @@ -269,36 +271,6 @@ const items = ["Dog", "Cat", "Platipus"]; ``` -### Slots - -Sometimes, an Astro component will be passed children. This is especially common for components like sidebars or dialog boxes that represent generic "wrappers” around content. - -```astro - - - -``` - -Astro provides a `` component so that you can control where any children are rendered within the component. This is heavily inspired by the [`` HTML element](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/slot). - -```astro ---- -// Example: components/WrapChildrenWithText.astro -// Usage: -// Renders:

Begin

End

---- -

Begin

- - -

End

-``` - - - - - ## Comparing `.astro` versus `.jsx` `.astro` files can end up looking very similar to `.jsx` files, but there are a few key differences. Here's a comparison between the two formats.