Skip to main content

useDisclosure

A hook to control open/close state.

Import#

import { useDisclosure } from '@pixby/ui';

Return value#

The useDisclosure hook returns an object with the following properties:

NameTypeDefaultDescription
isOpenbooleanfalseThe current state of the hook.
closefunctionChanges the state to false.
openfunctionChanges the state to true.
togglefunctionToggles the state between true and false.

Usage#

Result
SyntaxError: Unexpected token (1:8)
1 : return ()
            ^
Live Editor