domestic-ui GitHub

Disclosure

A summary that shows or hides more content, built on <details> and <summary>.

Where disclosures are used Disclosures are summary rows in the content area, such as an accordion of questions, that each open to show their content below.

Live example

Disclosure

<details>
  <summary>What is included in the plan?</summary>
  <p>Unlimited projects, five collaborators and email support.</p>
</details>

Exclusive accordion

<div data-disclosure="accordion">
  <details name="faq" open>
    <summary>Shipping</summary>
    <p>Orders ship within two working days.</p>
  </details>
  <details name="faq">
    <summary>Returns</summary>
    <p>Return unused items within 30 days for a full refund.</p>
  </details>
  <details name="faq">
    <summary>Warranty</summary>
    <p>Every product has a two-year warranty.</p>
  </details>
</div>

Accordion with several open

<div data-disclosure="accordion">
  <details>
    <summary>Monthly plan</summary>
    <p>Pay each month and cancel any time.</p>
  </details>
  <details>
    <summary>Yearly plan</summary>
    <p>Pay once a year and get two months free.</p>
  </details>
</div>

Inline show more

<p>The release adds pagination, tabs and toasts.</p>
<details data-disclosure="plain">
  <summary>Show the full list of changes</summary>
  <ul>
    <li>Twelve molecules with example pages.</li>
    <li>Five small web components.</li>
    <li>Four explainers for custom patterns.</li>
  </ul>
</details>

Attributes

Attribute or valueWhereEffect
data-disclosure="accordion"a wrapper around several <details>joins them into one bordered block
data-disclosure="plain"a <details>no box, for "Show more" text inside prose
name="group"each <details> (native)only one open
opena <details> (native)open on load

Keyboard

KeyAction
Tabmoves to the next summary / Shift+Tab: previous
Enter / Spaceopens or closes the focused section

Accessibility

  • <summary> is a button with aria-expanded (HTML-AAM), so there is no ARIA to write.
  • Unlike the APG Accordion, headers are not headings and have no arrow keys. Both are optional there.
  • Avoid exclusive groups (name) when people compare sections.

Specifications

See also

How other systems do it

For comparison only; these are not the standard this system follows.

Search