HTML <slot> Tag
Description
The <slot> element in HTML is a placeholder inside a Web Component’s shadow DOM where external content can be inserted. It allows developers to create reusable and encapsulated components while giving users the ability to pass in their own markup or content dynamically. Essentially, it defines a “slot” in a component’s structure that can be filled by content provided by the component’s consumer.
When a web component contains a <slot> element, the browser looks for content that is placed between the opening and closing tags of that component in the light DOM. If content is provided, it will be rendered at the <slot> location. If no content is provided, the slot can optionally display fallback content, which is specified inside the <slot> element itself.
Slots can be named or unnamed. An unnamed slot serves as the default placeholder for any content that isn’t assigned to a named slot. Named slots allow the component consumer to target specific slots with their content, making the component highly flexible.
The <slot> element is a cornerstone of the Shadow DOM composition model, enabling a clean separation between component structure (shadow DOM) and content (light DOM), promoting modularity, maintainability, and reusability in web applications.
Properties
- Permitted Parents
- Any element that accepts phrasing content
- Content
- Transparent
- Start/End Tags
- Start tag: required, End tag: required
Example
Attributes
- name
- The slot's name.
Global Attributes
The <slot> tag also supports the Global Attributes in HTML5
Event Attributes
None
Browser Support
The following information will show you the current browser support for the HTML <slot> tag. Hover over a browser icon to see the version that first introduced support for this HTML tag.
This tag is supported by all modern browsers.
Desktop
Tablets & Mobile
Last updated by CSSPortal on: 26th December 2025
