0Pricing
Sveltejs Academy · Lesson

Slot Fallback Content

Render default content inside a when the parent provides nothing.

Default Inside Slot

Content placed inside the <slot> tag is shown when the parent provides nothing.

<button>
  <slot>Click me</slot>
</button>

Best Defaults

Provide sensible defaults that work in most cases without parent involvement.

All lessons in this course

  1. Default Slots for Content Projection
  2. Named Slots with slot="name"
  3. Slot Fallback Content
  4. Checking Slot Content with $$slots
← Back to Sveltejs Academy