-
-
Notifications
You must be signed in to change notification settings - Fork 1.8k
Improve documentation on fallback content for slots #8302
Copy link
Copy link
Labels
add new contentDocument something that is not in docs. May require testing, confirmation, or affect other pages.Document something that is not in docs. May require testing, confirmation, or affect other pages.good first issueGood for newcomersGood for newcomershelp wantedIssues looking for someone to run with them!Issues looking for someone to run with them!
Description
📚 Subject area/topic
Fallback Content for Slots
📋 Suggested page
https://docs.astro.build/en/basics/astro-components/#fallback-content-for-slots
📋 General description or bullet points (if proposing new content)
There is a case where the default fallback content for slots is not displayed. This has been discussed on this issue in the withastro/astro repo.
So given component A and B below, the default fallback content is not shown when <slot name="s" slot="s" /> is present and empty. That is, when the slot is empty in component A, the fallback content is not shown.
Component B
<slot name="s">
<div>Default content</div>
</slot>Component A
<B>
<slot name="s" slot="s" />
</B>As Mathew wrote in the issue mentioned earlier, "Default content is rendered when a slot is not provided. Not when it is empty." This should be documented in the section about Fallback Content for Slots.
🖥️ Reproduction of code samples in StackBlitz
Link to the fallback behaviour on Stackblitz
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
add new contentDocument something that is not in docs. May require testing, confirmation, or affect other pages.Document something that is not in docs. May require testing, confirmation, or affect other pages.good first issueGood for newcomersGood for newcomershelp wantedIssues looking for someone to run with them!Issues looking for someone to run with them!