A hook to manage a popup state.

Parameters:
NameTypeDescription
argsobject

The arguments for the hook.

Properties
NameTypeDescription
closeOnClickOutsideboolean

Whether to close the popup when clicking outside.

customClickOutsideLogicfunction

Custom logic to determine if the popup should close when clicking outside.

durationnumber

The duration of the popup animation.

initialOpenboolean

The initial open state of the popup.

onAfterClosefunction

The callback after the popup is closed.

onAfterOpenfunction

The callback after the popup is opened.

onClosefunction

The callback when the popup is closed.

onOpenfunction

The callback when the popup is opened.

popupRefobject

The reference to the popup element.

triggerRefobject

The reference to the trigger element.

Since
  • 4.0.1
Returns:

The popup state.

Type: 
object

Methods

(inner) closePopup()

Close the popup.

Since
  • 4.0.1

(inner) handleEscKeyDown(event)

Handles the keydown event for the escape key.

Parameters:
NameTypeDescription
eventEvent

The event object.

Since
  • 4.0.1

(inner) openPopup()

Open the popup.

Since
  • 4.0.1