Documentation
Base
Contexts
PreviewContext

usePreviewContext

Description

The usePreview hook is a React hook for managing a Preview component. It provides a set of methods to control the visibility of the preview and handle associated events such as showing, hiding, and clicking the preview. This hook is particularly useful for implementing preview features in applications where previews need to be shown or hidden based on user interactions.

Properties

PropertyTypeDescription
elementHTMLElementThe HTML element associated with the preview.
shownbooleanThe state for the visibility of the Preview component.
hide(target?: EventTarget & HTMLElement) => voidFunction to hide the Preview component.
showFunctionFunction to show the Preview component.
...eventsPreviewEventsThe events associated with the Preview component.