coderef

Mutually exclusive <details> elementsBaseline · Newly available

Multiple &#x3C;details> elements which use the same name attribute are mutually exclusive. When one member of the group is opened, all other members are closed.

Works in the latest version of every major browser, but older devices may not support it yet. Baseline since Sep 3, 2024.

Browser support

DesktopChrome
1–119Not supported
120+Supportedsince Dec 5, 2023
Current: 155
Edge
12–119Not supported
120+Supportedsince Dec 7, 2023
Current: 154
Firefox
1–129Not supported
130+Supportedsince Sep 3, 2024
Current: 157
Safari
1–17.1Not supported
17.2+Supportedsince Dec 11, 2023
Current: 27
MobileChrome Android
18–119Not supported
120+Supportedsince Dec 5, 2023
Current: 155
Firefox Android
4–129Not supported
130+Supportedsince Sep 3, 2024
Current: 157
Safari iOS
1–17.1Not supported
17.2+Supportedsince Dec 11, 2023
Current: 27

How to use

Every current browser supports this, but it only became Baseline on Sep 3, 2024. Use it as a progressive enhancement, or keep a fallback if you support older devices.

Example

HTML
<!-- Opening one closes the others (accordion) -->
<details name="faq">
  <summary>Shipping</summary>
  <p>…</p>
</details>
<details name="faq">
  <summary>Returns</summary>
  <p>…</p>
</details>

Feature detection

JS · check before using
if ("HTMLDetailsElement" in globalThis && "name" in HTMLDetailsElement.prototype) {
  // HTMLDetailsElement.name is available
}

Sub-features

Support for each part of the feature (2). The overall table above shows when the whole feature works.

Sub-featureChromeEdgeFirefoxSafariChrome AndroidFirefox AndroidSafari iOS
HTMLDetailsElement.name12012013017.212013017.2
details.name12012013017.212013017.2