The slotglobal attribute assigns a light-DOM child to a named<slot> inside a parent’s shadow tree. Put slot="name" on the content you distribute; put matching <slot name="name"> in the component’s shadow root.
This is the light-DOM side of Web Components composition. Without a matching named slot, content falls through to the default (unnamed) <slot> if one exists.
Attribute vs element.
The slotattribute lives on light-DOM children. The <slot>element lives in the shadow tree and displays that content.
Only with shadow DOM.
On a normal host without a shadow root, slot has no composition effect — it is just an unused attribute.
Syntax
HTML Syntax
syntax.html
<element slot="slot-name">
The value is a string that must match a <slot name="..."> in the host’s shadow tree. Omit the attribute to use the default slot.
Match names exactly — they are case-sensitive strings.
Order in light DOM does not have to match visual order.
Style the host/slots; slotted nodes keep their own styles.
Edge Cases & Pitfalls
Most confusion comes from mixing up the attribute and the element.
name
Names must match exactly
slot="Title" does not fill <slot name="title"> — matching is case-sensitive.
scope
Only the host’s shadow tree
slot assignment is relative to the immediate shadow host, not ancestors.
fallback
Slot fallback content
Text inside <slot> appears only when nothing is assigned to that slot.
vs-tag
Attribute ≠ element
Document the <slot> element separately at /html/tags/slot.
Compatibility
Browser Support
slot is an HTML attribute for browsers. It is not a Node.js, Deno, or Bun API.
✓ Widely available
slot
Shadow DOM slot assignment works in modern Chromium, Firefox, and Safari.
95%Global support (approx.)
Google Chrome73+
Full support
Mozilla Firefox72+
Full support
Apple Safari13.1+
Full support
Microsoft Edge79+
Full support
Opera60+
Full support
Samsung Internet11+
Full support
Internet ExplorerNo support
Not supported
slotModern browsers
Bottom line: Safe for Web Components on modern sites. No IE support.
Remember
Key Takeaways
Role: map light-DOM content into a named shadow <slot>.
Value: a slot name matching <slot name> in the shadow tree.
Default: no attribute (or unknown name) targets the unnamed slot.
Related: see the <slot> element for the shadow side.
One line:slot tells a shadow host which named <slot> should receive this light-DOM child.
Frequently Asked Questions
It names which shadow <slot> a light-DOM child should fill when the host uses a shadow tree. The value must match a <slot name="..."> inside the shadow root.
No. The attribute goes on light-DOM children. The <slot> element lives in the shadow tree and receives that content.
Children without slot (or with an empty/unknown name) go into the default unnamed <slot> if the shadow tree provides one.
The attribute is global, but it only affects composition when the parent element has a shadow root with matching <slot> elements.
Yes. Each host’s light-DOM children are assigned relative to that host’s shadow tree — not the outer page’s slots.
Shadow DOM and slot assignment are widely available in modern browsers. Older IE has no support.