Skip to content

<summary> - Disclosure Summary

Interactive HTML5

The <summary> element defines the visible heading or label for a <details> disclosure widget. It serves as the clickable element that toggles the visibility of the details content. When clicked, it expands or collapses the associated details element.

Result
<details>
<summary>Summary text goes here</summary>
<!-- Hidden content -->
</details>

The <summary> element has no element-specific attributes.

The <summary> element supports all global attributes.

The <summary> element must be the first child of <details>:

<details>
<summary>Summary first</summary>
<p>Content follows</p>
</details>

If you omit <summary>, browsers display a default label:

Result

Summaries can contain any phrasing content, including formatting and icons:

Result
Result
Result
Result
Result

While the summary element works natively, you can enhance it with JavaScript:

Result

You can prevent the details from toggling under certain conditions:

Result
Result
Result

The summary element is inherently accessible:

Result
Result
  1. Descriptive text: Make summary content clear and actionable
  2. Keyboard accessible: Ensure all functionality works via keyboard
  3. Focus indicators: Provide visible focus styles
  4. Screen reader friendly: Use ARIA when additional context helps
  5. Avoid nesting interactive elements: Can confuse assistive tech
  6. Test thoroughly: Verify with actual screen readers

Excellent Support

The <summary> element is supported in all modern browsers:

  • Chrome: 12+ (2011)
  • Firefox: 49+ (2016)
  • Safari: 6+ (2012)
  • Edge: 79+ (2020)
  • Opera: 15+ (2013)
  • Mobile: Widely supported

Note: Must be used inside <details>. Behavior outside of <details> is undefined.

  1. Always use with <details>: Required parent element
  2. Must be first child: Place summary before other content
  3. Make it descriptive: Users should know what will be revealed
  4. Keep it concise: Summary should be brief and scannable
  5. Style focus states: Essential for keyboard users
  6. Avoid complex interactivity: Keep nested controls simple
  7. Test keyboard navigation: Enter/Space should toggle
  8. Consider mobile: Ensure touch targets are adequate

Learn More: