Disclosure
A disclosure is a widget that toggles the visibility of content by clicking a button.
Version 1.2.3
Installation
To install @igloo-ui/disclosure
in your project, you will need to run the following command using npm:
npm install @igloo-ui/disclosure
If you prefer Yarn, use the following command instead:
yarn add @igloo-ui/disclosure
Usage
Then to use the component in your code just import it!
import Substract from '@igloo-ui/icons/dist/Substract';
import Disclosure from '@igloo-ui/disclosure';
<Disclosure
title="Diversity"
icon={<Substract size="large" />}
description="0.8pt in the last 30 days"
>
<div style={{ background: '#F7F9FA', padding: '2.4rem' }}>
Our organization values diversity.
</div>
</Disclosure>;
API
Prop | Type | Default | Description |
---|---|---|---|
children | ReactNode | - | The component content to display when expanding |
className | string | - | Add a specific class to the disclosure |
dataTest | string | - | Add a data-test tag for automated tests |
defaultExpanded | boolean | Whether or not the disclosure is expanded by default (uncontrolled) | |
description | ReactNode | - | The description of the disclosure |
icon | ReactNode | - | An icon to show as the first element in disclosure |
isExpanded | boolean | - | Whether or not the disclosure is expanded (controlled) |
isLowContrast | boolean | True for a light appearance (no shadow, icon or border) | |
onClose | () => void | - | Callback when the disclosure is closed |
onOpen | () => void | - | Callback when the disclosure is opened |
title | string | - | The title of the disclosure |