← All components
Specimen U-003 · control

Disclosure

Collapsible sections that open to their natural height while the content slides in after. Stack as many as you like.

  • [ 0 deps ]No JavaScript and no packages. Just HTML and CSS you paste into your project.
  • state: aria-expandedYour code changes aria-expanded (or data-state) on the element; the CSS animates the change. That attribute is the only thing you wire up.
  • early releaseReady to use, but names of classes and settings may still change before version 1.0. Pin the version you copy.
  • all modern browsersUses only CSS that Chrome, Safari, Firefox and Edge have all supported for at least 2.5 years (Baseline widely available).
  • 1.06 kB · moderateThe CSS is 1083 bytes after gzip, which is how browsers download it. Lightweight is under 1 kB, moderate under 2.5 kB, heavy above.

We deliver Monday to Friday between 8:00 and 18:00. On the morning of delivery you get a text with a two-hour window.

Send anything back within 30 days, unused and in its box. The return label is in your order email.

Fig. 01 — 125 % · click to toggle
State
Variant
Icon side
Title on open

The title stays put.

Icon line ends

Rounded ends and corners.

Colour Auto · follows the text colour
Preview background
<div class="u-disclosure-group">
  <div class="u-disclosure">
    <button class="u-disclosure__trigger" type="button" aria-expanded="false" aria-controls="delivery-details">
      <span class="u-disclosure__label">Delivery details</span>
      <svg class="u-disclosure__icon" viewBox="0 0 24 24" fill="none" stroke="currentColor" aria-hidden="true" focusable="false">
        <line class="u-disclosure__bar u-disclosure__bar--h" x1="5" y1="12" x2="19" y2="12" />
        <line class="u-disclosure__bar u-disclosure__bar--v" x1="12" y1="5" x2="12" y2="19" />
        <polyline class="u-disclosure__chev" points="6 9 12 15 18 9" />
      </svg>
    </button>
    <div class="u-disclosure__panel" id="delivery-details" role="region" aria-label="Delivery details">
      <div class="u-disclosure__inner">
        <p>We deliver Monday to Friday between 8:00 and 18:00. On the morning of delivery you get a text with a two-hour window.</p>
      </div>
    </div>
  </div>
  <div class="u-disclosure">
    <button class="u-disclosure__trigger" type="button" aria-expanded="false" aria-controls="returns">
      <span class="u-disclosure__label">Returns</span>
      <svg class="u-disclosure__icon" viewBox="0 0 24 24" fill="none" stroke="currentColor" aria-hidden="true" focusable="false">
        <line class="u-disclosure__bar u-disclosure__bar--h" x1="5" y1="12" x2="19" y2="12" />
        <line class="u-disclosure__bar u-disclosure__bar--v" x1="12" y1="5" x2="12" y2="19" />
        <polyline class="u-disclosure__chev" points="6 9 12 15 18 9" />
      </svg>
    </button>
    <div class="u-disclosure__panel" id="returns" role="region" aria-label="Returns">
      <div class="u-disclosure__inner">
        <p>Send anything back within 30 days, unused and in its box. The return label is in your order email.</p>
      </div>
    </div>
  </div>
</div>
Use it in your project

Three steps, no install.

  1. 01

    Add the CSS

    Copy the CSS tab into your stylesheet, or save it as disclosure.css and link it. It works on its own; our design tokens are optional.

  2. 02

    Paste the markup

    Copy the HTML tab where the disclosure should go. Your playground choices (variant, size, colour…) are already in it.

  3. 03

    Flip the state

    Set aria-expanded to "true" or "false" from your code. That's the whole wiring. Pick your framework below.

Accessibility

Each trigger is a <button> with aria-expanded and aria-controls pointing at its panel's id, so give every panel a unique id. Closed panels are visibility: hidden, so their links and fields can't be tabbed into.

Source

packages/core/src/components/disclosure