useDisclosure

Control the open state of a modal, drawer or any other disclosure, with optional callbacks.

This is custom React hooks, you need to follow the Basic Rules when you use it.

General

Open and close a modal from the handlers.

APIs

useDisclosure

const useDisclosure = (
  initialState?: boolean,
  options?: { onOpen?: () => void; onClose?: () => void },
) => [
  boolean,
  { open: () => void; close: () => void; toggle: () => void },
]
Edit this page on GitHub