# What are slots in LWC and what is the difference between default and named slots?

**Topic:** Development · **Difficulty:** Easy · **Tags:** lwc, slots, templates

Read it on the site: https://www.forcechallenges.com/interview-questions/what-are-slots-in-lwc-and-what-is-the-difference-between-default-and-named-slots

## Answer

Slots let a parent pass markup into a child's template, making components reusable containers.

**Child:**
```html
<template>
  <header><slot name="header"></slot></header>
  <slot></slot>
</template>
```
**Parent:**
```html
<c-card>
  <span slot="header">Title</span>
  <p>Default slot content</p>
</c-card>
```
- **Default (unnamed) slot** receives all content without a `slot` attribute.
- **Named slot** receives content with a matching `slot="name"`.

LWC supports slots but not scoped slots.

---
Source: ForceChallenges · last updated 2026-10-19
