Provides the behavior and accessibility implementation for a disclosure component.
Example
Disclosure.tsx
Disclosure.css
Content.css
Example
Disclosure.tsx
Disclosure.css
Content.css
Example
Disclosure.tsx
Disclosure.css
Content.css
import {Disclosure} from './Disclosure';
<Disclosure title="System Requirements">
Details about system requirements here.
</Disclosure>
API
<Disclosure>
<Heading>
<Button slot="trigger" />
</Heading>
<DisclosurePanel />
</Disclosure>
useDisclosureState (props: DisclosureProps ): DisclosureStateuseDisclosureGroupState (props: DisclosureGroupProps ): DisclosureGroupStateuseDisclosure(
props: AriaDisclosureProps,
state: DisclosureState,
ref: RefObject <HTMLElement | null >
): DisclosureAriaDisclosureState
Properties
| Name | Type | |
|---|---|---|
isExpanded | boolean | |
Whether the disclosure is currently expanded. | ||
Methods
setExpanded | ||
| Sets whether the disclosure is expanded. | ||
expand | ||
| Expand the disclosure. | ||
collapse | ||
| Collapse the disclosure. | ||
toggle | ||
| Toggles the disclosure's visibility. | ||
AriaDisclosureProps
| Name | Type | |
|---|---|---|
isDisabled | boolean | |
Whether the disclosure is disabled. | ||
isExpanded | boolean | |
Whether the disclosure is expanded (controlled). | ||
defaultExpanded | boolean | |
Whether the disclosure is expanded by default (uncontrolled). | ||
DisclosureAria
| Name | Type | |
|---|---|---|
buttonProps | AriaButtonProps | |
Props for the disclosure button. | ||
panelProps | HTMLAttributes | |
Props for the disclosure panel. | ||