Auto-slotting components via <Host slot="component-name">
#4183
gfellerph
announced in
Architecture Decisions
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Context
Discussion: #3476
It's possible to render components with a slot attribute by default. This reduces the need for authors to specify the slot attribute every time.
Decision
Use auto-slotting only on components that are enforcing a parent-child relationship.
Consequences
Authors are able to reuse components also in default and other named slots but have to specify the slot attribute.
Example
Do
<post-list-item>
can only be placed inside<post-list>
. Enforce the relationship through auto-slotting.post-list-item.tsx
Don't
A
<post-closebutton>
can be used in many different places. Don't use auto-slotting here.post-closebutton.tsx
Beta Was this translation helpful? Give feedback.
All reactions