liveBook · Manning

Shadow host

Also called host element

A shadow host is a DOM element to which a shadow root is attached and whose shadow tree it contains.

How 3 Manning books explain it

Pro Angular 16

A host element is the HTML element affected by an Angular binding through changes to its appearance, content, or behavior.

How it is used
Identifies the HTML element affected by a binding or directive, the source of a bound event, or the element hosting a component.
How deep it goes
Defines the host’s role and illustrates binding, event, directive, and component behavior without detailing rendering internals.
Examples
Uses a div with `ngClass`, a table cell handling `mouseover`, configured directive attributes, and component elements in a template.
What you can do after
Apply it via Angular templates to identify which element a binding changes, sends an event, configures a directive, or hosts a component.

Read how Pro Angular 16 explains shadow host →

Web Components in Action

A shadow host is the page-DOM node to which a shadow root is attached and whose shadow tree it parents.

How it is used
Explains how a Web Component’s page-DOM element relates to its shadow root and controls styling at the component boundary.
How deep it goes
Defines the host, root, tree, and boundary, then demonstrates host styling; it stops short of broader Shadow DOM internals.
Examples
Uses a stepper component, sample-component selectors, :host rules, attachShadow(), and page-level text styling.
What you can do after
Apply host styling with :host and distinguish the page element from its shadow root and internal shadow tree.

Read how Web Components in Action explains shadow host →

Vanilla Web

The element to which a shadow root is attached and which represents the component externally.

How it is used
Defines the component’s externally visible element and the boundary between page DOM and shadow DOM.
How deep it goes
Defines the host as a boundary and demonstrates `:host` styling, while deferring broader lifecycle details.
Examples
Uses a counter-button custom element and a shadow-DOM component with isolated styles.
What you can do after
Apply `:host` to style a shadow-DOM host, including setting its display behavior.

Read how Vanilla Web explains shadow host →

Also covered in

Related concepts

Questions about shadow host

What is shadow host?

A shadow host is a DOM element to which a shadow root is attached and whose shadow tree it contains.

Which Manning books explain shadow host?

Pro Angular 16, Web Components in Action and Vanilla Web.

What is shadow host part of?

Shadow host is part of Web Components. Web Components are browser standards and APIs, including custom elements and shadow DOM, for creating reusable web interface elements with encapsulated structure, presentation, and behavior.

What are the parts of shadow host?

Shadow host includes shadow root.

What is shadow host also called?

Shadow host is also called host element.

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.