Skip to main content

Disclosure

Allow the user to show or hide additional content about a topic

Overview #

Use the disclosure component to allow the user to show or hide additional content about a topic.

Examples #


<div class="rvt-disclosure" data-rvt-disclosure="disclosure-1">
<button class="rvt-disclosure__toggle" data-rvt-disclosure-toggle aria-expanded="false">Take a look at the numbers</button>
<div class="rvt-disclosure__content" data-rvt-disclosure-target hidden>
<div class="rvt-prose rvt-flow">
<p>Tuition and fees vary at each Indiana University campus. As you look at total costs, keep in mind that financial aid, scholarships and awards, a part-time job, and student loans can all factor into what you will pay for your degree.</p>
</div>
</div>
</div>

Attributes #

Use the following attributes to configure a disclosure:

Attribute Description
rvt-disclosure-open-on-init Add to the root data-rvt-disclosure element to open the disclosure on page load

Usage #

Do

  • Use to hide lengthy information that is secondary or low priority
  • Use you need to conserve space in long passages of text
  • Use to reveal additional information about a topic

Don't

  • Use to hide critical or required instructions
  • Use to hide an element-use the .rvt-display-none or .rvt-sr-only utility classes instead
  • Group multiple disclosures together—use an accordion instead

Accessibility #

ARIA labels #

Label Description
aria-expanded Added to the button element with the data-rvt-disclosure-toggle attribute by the component’s JavaScript. Set to true if the disclosure is open; false otherwise.

Keyboard navigation #

Keys Description
enter or space Open the disclosure if focus is on the trigger button

JavaScript #

Method Description
open() Opens the disclosure
close() Closes the disclosure
Event Description Details object properties
rvt:disclosureOpened Emitted when a disclosure is opened
rvt:disclosureClosed Emitted when a disclosure is closed

Learn more about using Rivet JavaScript