In JavaScript, the slot property of Element returns the name of the shadow DOM slot the element is inserted in. It reflects the HTML slot attribute (MDN).
Read the notes below before you get or set this property. Prefer feature detection when support is limited.
Syntax
Use el.slot. Start with this line.
JavaScript
el.slot
Call
What it does
el.slot
Primary signature.
Built into the browser. Read or assign el.slot — no import required.
Library declarations
JavaScript
el.slot
Parameters
Parameter
Description
Shadow host + slots
Required. Defines named / default placeholders
Light-DOM child
Required. Content that fills a slot
No slot attr
Optional. Goes to the unnamed default slot
Return Value
Return Value
Description
*
The current value of el.slot.
JavaScript Examples
Example 1 — Read slot
MDN-style: log the named slot on a light-DOM child.
Empty slot means not targeting a named slot (MDN).
Default unnamed <slot> can receive that child.
Named slots stay empty unless another child claims them.
Compatibility
Browser Support
Element.slot is Baseline Widely available (MDN: across browsers since January 2020). It is not Deprecated, Experimental, or Non-standard.
✓ Baseline Widely available
Element.slot
Reflects the HTML slot attribute as the name of the shadow DOM slot this element targets.
BaselineWidely available
Google ChromeSupported · Desktop & Mobile
Full support
Mozilla FirefoxSupported · Desktop & Mobile
Full support
Apple SafariSupported · macOS & iOS
Full support
Microsoft EdgeSupported · Chromium
Full support
Internet ExplorerNo native support · Use a polyfill
Polyfill
OperaSupported · Modern versions
Full support
Samsung InternetSupported · Android
Full support
Android WebViewSupported · Modern WebView
Full support
slotBaseline
Bottom line: Safe for modern web components. Match light-DOM slot names to shadowvalues; use assignedSlot for the element.
Frequently Asked Questions
It returns the name of the shadow DOM slot the element is inserted in. It reflects the HTML slot attribute as a string (MDN).
No. MDN marks Element.slot as Baseline Widely available (since January 2020). It is not Deprecated, Experimental, or Non-standard.
An empty string means the element has no named slot attribute — it may still fill the default unnamed <slot> if one exists (MDN).
No. You can read and write element.slot. Setting it updates the matching slot attribute.
Inside a shadow tree you place <slot name="my-text">. Light-DOM children with slot="my-text" fill that named slot. element.slot then returns "my-text".
No. Element.slot is a string on slotted content. <slot> elements are HTMLSlotElement instances inside the shadow tree. Use assignedSlot to get the <slot> element.