Disclosure
Importing
Add rh-disclosure to your page with this import statement:
<script type="module">
import '@rhds/elements/rh-disclosure/rh-disclosure.js';
</script>
Copy to Clipboard
Copied!
Wrap lines
Overflow lines
To learn more about installing RHDS elements on your site using an import map read our getting started docs.
Lightdom CSS shim
Warning
Lightdom CSS shims are an optional, temporary solution for reducing CLS. Learn more about lightdom CSS shims .
<link rel="stylesheet" href="/path/to/rh-disclosure/rh-disclosure-lightdom-shim.css">
Note
Replace /path/to/
with path to the CSS file, whether local or CDN.
Usage
<rh-disclosure summary="Collapsed panel title">
<p>Lorem ipsum dolor sit amet consectetur adipisicing, elit. Velit distinctio, nesciunt nobis sit, a dolor, non numquam rerum recusandae, deserunt enim assumenda quidem. Id impedit necessitatibus obcaecati ratione reprehenderit laborum?</p>
</rh-disclosure>
<script type="module">
import '@rhds/elements/rh-disclosure/rh-disclosure.js';
</script>
Copy to Clipboard
Copied!
Wrap lines
Overflow lines
rh-disclosure
A disclosure toggles the visibility of content when triggered.
Slot Name | Description |
---|---|
|
Place the content you want to disclose in the default slot. This content is hidden by default. |
summary |
The title of the disclosure |
Attribute | DOM Property | Description | Type | Default |
---|---|---|---|---|
color-palette |
colorPalette |
Set the colorPalette of the disclosure. Overrides parent context. Possible values are:
|
|
|
open |
open |
Sets the disclosure to be in its open state |
|
|
summary |
summary |
Sets the disclosure title via an attribute |
|
|
Event Name | Description |
---|---|
toggle |
Fires when a user opens or closes a disclosure. |
Part Name | Description |
---|---|
caret |
The caret icon in the shadow DOM |
Token | Copy |
---|---|
--rh-border-width-md
|
|
--rh-border-width-sm
|
|
--rh-box-shadow-sm
|
|
--rh-color-border-subtle
|
|
--rh-color-brand-red
|
|
--rh-color-interactive-primary-default
|
|
--rh-color-surface
|
|
--rh-color-surface-dark
|
|
--rh-color-surface-lighter
|
|
--rh-color-text-primary
|
|
--rh-font-family-body-text
|
|
--rh-font-size-body-text-md
|
|
--rh-font-weight-body-text-medium
|
|
--rh-line-height-body-text
|
|
--rh-space-lg
|
|
--rh-space-md
|
|
--rh-space-xl
|
|
Other libraries
To learn more about our other libraries, visit this page.
Feedback
To give feedback about anything on this page, contact us.