The open attribute is a Boolean on <details> and <dialog>. When present, a disclosure starts expanded, or a dialog is shown (as a non-modal dialog). When absent, details start closed and the dialog is not displayed.
Pair details with <summary> for the label. Users can still toggle details; the attribute only sets the initial (and current) open state.
Baseline · Widely available (details).
Not deprecated. Boolean: presence means on. Write open, not open="false".
Dialog: prefer show() / showModal().
MDN recommends opening dialogs with JavaScript methods. Markup <dialog open> is non-modal and already visible on load — fine for demos, not the best pattern for interactive modals.
Syntax
HTML Syntax
syntax.html
<details open> … </details>
<dialog open> … </dialog>
In JavaScript: element.open = true or false reflects the attribute on both elements.
Omit open, then watch the toggle event update a status line.
HTML
<p id="state">open: false</p>
<details id="d">
<summary>More info</summary>
<p>Hidden until you open the disclosure.</p>
</details>
<script>
var d = document.getElementById("d");
d.addEventListener("toggle", function () {
document.getElementById("state").textContent =
"open: " + d.open;
});
</script>
After OK, reopen via Try It Yourself. Prefer showModal() in apps.
How It Works
open on <dialog> shows it as non-modal.
Page loads with the dialog already visible.
method="dialog" on the form closes it when submitted.
For modals use dialog.showModal() instead of the attribute.
Edge Cases & Pitfalls
Boolean rules and dialog modality cause most confusion.
boolean
open="false" still opens
Remove the attribute (or set .open = false) to close.
dialog
Attribute open ≠ modal
<dialog open> is non-modal. Use showModal() for a true modal with backdrop and Esc dismiss.
summary
Always include <summary>
Without it, the UA may invent a default label. Put a clear summary first inside details.
name
Grouped details: only one open
Same name on several details makes an accordion. If several have open, only the first in source order stays open.
style
Style open state with [open] or :open
details[open] (and :open where supported) targets the expanded widget.
Compatibility
Browser Support
open is an HTML Boolean attribute on details and dialog. It is not a Node.js, Deno, or Bun API.
✓ Baseline · Widely available
open
Supported on modern browsers for details disclosures and dialog. Prefer showModal() for interactive modal dialogs.
96%Global support (approx.)
Google ChromeYes
Full support
Mozilla FirefoxYes
Full support
Apple SafariYes
Full support
Microsoft EdgeYes
Full support
OperaYes
Full support
Samsung InternetYes
Full support
Internet ExplorerNo
Not supported
openWidely supported
Bottom line: Safe to use for details. For dialogs, learn the attribute, then prefer show() / showModal() in real UIs.
Remember
Key Takeaways
Boolean on details and dialog.
Presence = open; omit to start closed / hidden.
details.open reflects state; listen for toggle.
Dialogs: prefer showModal() over the attribute.
One line:open is the Boolean that starts a disclosure expanded or shows a non-modal dialog.
Frequently Asked Questions
It is a Boolean attribute on <details> and <dialog>. When present, details content is visible, or a dialog is shown as a non-modal dialog. When absent, details start closed and a dialog is not displayed.
No. Boolean attributes are on when present. open="false" still means open. Remove the attribute entirely to close.
MDN recommends show() or showModal() instead of the open attribute. Markup with open creates a non-modal dialog already visible on load; modal dialogs need showModal().
Set details.open = true or element.setAttribute("open", ""). Set details.open = false or removeAttribute("open") to close. Listen for the toggle event after the state changes.
No. It is standard on details and dialog. Prefer dialog methods for interactive dialogs.
Yes. The name attribute on details groups them so only one in the group can be open at a time (accordion-style), independent of the open attribute itself.