Documentation
Base
Contexts
ViewerContext

useViewerContext

Description

The useViewerContext hook manages the state and behavior of the viewer component. It provides a comprehensive set of methods and properties to control the opening, closing, showing, and hiding of the viewer. The hook integrates with animations, transitions, and config to offer a seamless viewing experience.

Properties

PropertyTypeDescription
animationAnimationContains the animation-related methods and values.
transitionTransitionContains the transition-related methods and values.
configurableConfigurableContains the configurable-related methods and values.
mountedbooleanIndicates whether the viewer is currently mounted in the DOM.
shownbooleanIndicates whether the viewer is currently shown.
openFunctionMethod to open the viewer.
closeFunctionMethod to close the viewer.
onOpenFunctionCallback function triggered when the viewer opens. If the function returns a truthy value, then the function will prevent the viewer component from opening.
onShowFunctionCallback function triggered when the viewer is shown. If the function returns a truthy value, then the function will prevent the viewer component from opening.
onCloseFunctionCallback function triggered when the viewer closes. If the function returns a truthy value, then the function will prevent the viewer component from opening.
onHideFunctionCallback function triggered when the viewer is hidden. If the function returns a truthy value, then the function will prevent the viewer component from opening.