HTML Attributes

HTML shadowrootmode attribute

Makes an eligible template declaratively create a shadow root on its parent during HTML parsing. open exposes the root through host.shadowRoot; closed does not provide access through that property. Applicable elements include: <template>. Check each element’s value rules.

Formal Syntax & Structure

html syntaxhtml
shadowrootmode="open"

Parameters & Attributes

NameTypeDescription
shadowrootmodeenumerated: open, closedMakes an eligible template declaratively create a shadow root on its parent during HTML parsing. open exposes the root through host.shadowRoot; closed does not provide access through that property.

Working Example

Example Snippethtml
<div>  <template shadowrootmode="open">    <p>Shadow content</p>  </template></div>
HTML Reference