liveBook · Manning

Named slot

A named slot is a shadow-DOM insertion point identified by a name that receives child content with a matching slot attribute.

How 2 Manning books explain it

Web Components in Action

A slot identified by a name so that matching child content can be assigned to a specific distribution point.

How it is used
Uses labeled placeholders to let custom-element consumers provide content through a Shadow DOM boundary.
How deep it goes
Explains declarations, matching attributes, fallback content, and unnamed alternatives, but stops short of slot API internals.
Examples
Demonstrates a business card with named personal details and a generic component using an unnamed slot.
What you can do after
Apply it via Web Components by declaring named placeholders and assigning matching child content.

Read how Web Components in Action explains named slot →

Vanilla Web

A named slot is a slot with a name attribute that receives only child nodes whose slot attribute has the matching value.

How it is used
Composes custom-element layouts from component-owned structure and consumer-provided content.
How deep it goes
Defines name matching, uniqueness, coexistence with default slots, and the empty-string assignment case.
Examples
Uses title, media, and actions as named regions in component layouts.
What you can do after
Apply named slots to compose component layouts from consumer-provided children.

Read how Vanilla Web explains named slot →

Also covered in

Related concepts

Questions about named slot

What is named slot?

A named slot is a shadow-DOM insertion point identified by a name that receives child content with a matching slot attribute.

Which Manning books explain named slot?

Web Components in Action and Vanilla Web.

What is the difference between named slot and unnamed slot?

A named slot is a shadow-DOM insertion point identified by a name that receives child content with a matching slot attribute. An unnamed slot is a slot without a name that receives child content not assigned to a named slot.

What is named slot a kind of?

Named slot is a kind of slot element. The HTML slot element defines an insertion point in a web component’s shadow tree for content supplied by its consumer.

These guides are generated from the text of Manning books by Manning's knowledge graph and link to the sections they draw on. The full books are available on liveBook and at manning.com.