<slot>: The SLOT Element
Last updated: 2026-10-13
<slot>The SLOT Element
Defines a 'slot' in a shadow DOM for Web Components—a placeholder where host content is projected; name enables named distribution.
| Category | Scripts & Embedding |
|---|---|
| Content Model | Flow content |
| Allowed Parents | Any element that accepts flow content |
| Content Tag | Yes — requires closing </slot> tag |
| Status | Standard |
📝 Syntax
<slot name="title"></slot>
⚙️ Attributes
This element supports the global attributes plus the following:
| Attribute | Value | Description |
|---|---|---|
name | Slot name; host content with slot="name" fills it; omitted is the default slot. |
▶ Example
Edit the code below and see the live result in the playground:
🌐 Browser Support
| Browser | |||||
|---|---|---|---|---|---|
| <slot> | ✓ v1 | ✓ v12 | ✓ v1 | ✓ v1 | ✓ v1 |
| Supported in all major browsers | |||||
Tip: slot only works inside shadow DOM / Web Components; in a normal page it has no distributing effect.
❓ FAQ
QWhat does slot do?
A
<slot> is the placeholder of Web Components: a hole dug in the Shadow DOM of a custom element that real content fills when the component is used. <slot name='title'> maps to the user's slot='title' content, separating content from component structure.QWhat shows when a slot is not filled?
AIts fallback content: whatever sits between
<slot>default text</slot> renders only when the consumer provides nothing for that slot. This gives components a sensible default state.QMust slot be used together with template?
AThey usually pair —
<template> defines the Shadow DOM structure with slots dug into it — but slots also work in JS-created shadow roots. Conversely, template alone (client-side templating) needs no slot. They are different partners in the Web Components system.🏷️ Related Tags
💡 Related Cases
More case studies coming soon — check back later.