Declarative shadow DOMBaseline · Widely available
The shadowrootmode attribute on <template> creates a shadow root without the use of JavaScript. It is a declarative alternative to the attachShadow() method.
Supported in all major browsers for at least 30 months — safe to use without fallbacks. Baseline since Feb 20, 2024. Widely available since Aug 20, 2026.
Browser support
DesktopChrome
1–110Not supported
111+Supportedsince Mar 7, 2023
Current: 155Edge
12–110Not supported
111+Supportedsince Mar 13, 2023
Current: 154Firefox
1–122Not supported
123+Supportedsince Feb 20, 2024
Current: 157Safari
1–16.3Not supported
16.4+Supportedsince Mar 27, 2023
Current: 27MobileChrome Android
18–110Not supported
111+Supportedsince Mar 7, 2023
Current: 155Firefox Android
4–122Not supported
123+Supportedsince Feb 20, 2024
Current: 157Safari iOS
1–16.3Not supported
16.4+Supportedsince Mar 27, 2023
Current: 27How to use
This feature is Baseline widely available — use it freely, no fallback needed.
Example
HTML
<user-card>
<template shadowrootmode="open">
<style>:host { display: block; border: 1px solid #ccc; }</style>
<slot name="name"></slot>
</template>
<span slot="name">Ada Lovelace</span>
</user-card>Feature detection
JS · check before using
if ("HTMLTemplateElement" in globalThis && "shadowRootClonable" in HTMLTemplateElement.prototype) {
// HTMLTemplateElement.shadowRootClonable is available
}Documentation (MDN)
Specification
Usage share
Sub-features
Support for each part of the feature (9). The overall table above shows when the whole feature works.
| Sub-feature | Chrome | Edge | Firefox | Safari | Chrome Android | Firefox Android | Safari iOS |
|---|---|---|---|---|---|---|---|
| HTMLTemplateElement.shadowRootClonable | 124 | 124 | 125 | 18 | 124 | 125 | 18 |
| HTMLTemplateElement.shadowRootDelegatesFocus | 123 | 123 | 123 | 18 | 123 | 123 | 18 |
| HTMLTemplateElement.shadowRootMode | 111 | 111 | 123 | 16.4 | 111 | 123 | 16.4 |
| HTMLTemplateElement.shadowRootSerializable | 125 | 125 | 128 | 18 | 125 | 128 | 18 |
| HTMLTemplateElement.shadowRootSlotAssignment | 152 | 152 | 151 | 27 | 152 | 151 | 27 |
| template.shadowrootclonable | 124 | 124 | 125 | 17.5 | 124 | 125 | 17.5 |
| template.shadowrootdelegatesfocus | 123 | 123 | 123 | 16.4 | 123 | 123 | 16.4 |
| template.shadowrootmode | 111 | 111 | 123 | 16.4 | 111 | 123 | 16.4 |
| template.shadowrootserializable | 125 | 125 | ✕ | 18 | 125 | ✕ | 18 |