Interactive Elements

HTML <details> element

Creates a disclosure widget that users can expand or collapse. The first summary supplies the disclosure label; open is a boolean attribute. The summary provides the disclosure label. The open attribute reflects the expanded state; the toggle event can observe changes. Do not replace the native interaction with an inaccessible clickable div. It accepts global HTML attributes; individual global features may be inapplicable or restricted.

Formal Syntax & Structure

html syntaxhtml
<details>  <summary>More</summary>  Content</details>

Parameters & Attributes

NameTypeDescription
namenonempty stringGroups details elements so at most one is open in the named group.
openbooleanMakes details expanded or dialog visible in its non-modal open state. Setting open is not equivalent to calling showModal() on dialog.

Return Value

HTMLDetailsElement

Content model: One summary followed by flow content.

Working Example

Example Snippethtml
<!doctype html><html lang="en">  <head>    <meta charset="utf-8">    <title>HTML example</title>  </head>  <body>    <details>      <summary>Opening hours</summary>      <p>Monday to Friday, 9–5.</p>    </details>  </body></html>

Browser Compatibility

Minimum supported versions across modern rendering engines

Widely Available (2020)
WebKit / Blink
Chrome
12
Yes
Gecko
Firefox
49
Yes
WebKit
Safari
6
Yes
Basic disclosure element; grouped details and search-to-open have separate support. Edge and Opera versions not resolved from mirrored source rows.
HTML Living Standard
HTML Reference