Checking Slot Content with $$slots
Inspect $$slots to conditionally render wrapper markup only when a slot is used.
Why Check Slots
Sometimes you only want to render wrapper markup (border, header) if the slot has content.
The slots Object
Inside a component, $$slots is an object with a property per filled slot.
All lessons in this course
- Default Slots for Content Projection
- Named Slots with slot="name"
- Slot Fallback Content
- Checking Slot Content with $$slots