Exclusive Accordions
Accordions present an interesting way to display content using one or more [details](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/details) elements. There is a specific type of accordion that, until recently, was impossible to do without scripting, the exclusive accordion. This post will explain what's an exclusive accordion and how to polyfill the API to handle older browsers. ## What are exclusive accordions and how they work To achieve this on the web you can now a `name` attribute to `details` elements. When this attribute is used, all `details` elements with the same name value form a semantic group and will behave as an exclusive accordion. When you open one of the `details` elements that share the same name, the previously opened one will automatically close. In the example below we have three items in the accordion with the first one being open by default when the page opens. When you click on the other items, it will open the item you click and close the one currently open. ```html