Skip to main content

Function: useModal()

useModal(config?): UseModalReturn

Defined in: hooks/useModal/index.tsx:31

useModal

Parameters

config?

Configuration for the modal.

areaId?

string

The ID of the DOM element to render the modal into.

Returns

UseModalReturn

An object containing the Modal component and state management functions.

Description

A custom hook to manage the state of a Modal component.

Example

const { Modal, open, close } = useModal();
<Button onClick={open}>Open Modal</Button>
<Modal title="My Modal">Content</Modal>