Skip to content

Disclosure

a primitive for creating a Disclosure component.

Anatomy

Figure: Anatomy of Disclosure component

API Reference

createDisclosure(args?: DisclosureArguments): AriaDisclosure;

Parameters [DisclosureArguments]

Name Type Default Description
defaultVisible boolean false Whether the Disclosure is open by default (uncontrolled).
id string - Custom unique identifier of the disclosure content element.
isButtonElement boolean true Whether the disclosure toggle is a button element, default to true. Set this to false if you want to use a different element than a button.
isVisible boolean - Whether the Disclosure is open by default (controlled).
onVisibilityChange (isOpen: boolean) => void - Handler that is called when the Disclosure visibility state changes.

Return value [AriaDisclosure]

Name Type Description
contentProps * JSX.HTMLAttributes<any> The toggle button properties.
state * { isVisible: boolean } The current state of the disclosure.
toggleProps * JSX.HTMLAttributes<any> The content element properties.

Example

Screen reader