useFullscreen

A Hook that is able to set dom element to be full-screen.

const [isFullscreen, { setFull, exitFull, toggleFull }] = useFullScreen(target, options?:Options);

Example

Basic usage of useFullscreen hook.

API

useFullscreen - Params

PropertyDescriptionTypeDefault
targetDOM element or Ref ObjectHTMLElement | () => HTMLElement | React.MutableRefObject-
optionssetting(optional)Options-

useFullscreen - Options

PropertyDescriptionTypeDefault
onExitFulllisten for exit full screen events() => void-
onFulllisten for full screen events() => void-

useFullscreen - Result

PropertyDescriptionType
isFullscreenWhether it is the full screen stateboolean
setFullset full screen() => void
exitFullexit full screen() => void
toggleFulltoggle full screen() => void