useDisclosure

useDisclosure is a custom hook that helps handle common open/close or toggle scenarios. It can be used to control components such as Modal, Dialog, Drawer, etc.

Usage

import { useDisclosure } from "@yamada-ui/react"
const { open, onOpen, onClose, onToggle } = useDisclosure()

Using Callback Functions

To use callback functions, assign a function to onOpen or onClose. This is useful for executing APIs or other logic before opening components such as Modal.

By default, the callback functions are executed before onOpen or onClose. If you want the callbacks to be executed after onOpen or onClose, set the timing option to "after".

Used By Components & Hooks

ActionBar

ActionBar is a component that is used to display a bottom action bar with a set of actions.

Menu

Menu is a component that displays a common dropdown menu.

Modal

Modal is a component that is displayed over the main content to focus the user's attention solely on the information.

Popover

Popover is a component that floats around an element to display information.

Sidebar

Sidebar is a component used to display a list of items in a sidebar.

Tooltip

Tooltip is a component that displays short information, such as supplementary details for an element.

Tree

Tree is a component used to display hierarchical data structures in an expandable tree format.