Skip to content
On this page

useFullscreen

manages DOM full screen.

Code demonstration

Image full screen

API

const [
  isFullscreen,
  {
    enterFullscreen,
    exitFullscreen,
    toggleFullscreen,
    isEnabled,
  }] = useFullScreen(
    target,
    options?: Options
  );
const [
  isFullscreen,
  {
    enterFullscreen,
    exitFullscreen,
    toggleFullscreen,
    isEnabled,
  }] = useFullScreen(
    target,
    options?: Options
  );

Params

PropertyDescriptionType
targetDOM element or refElement
optionSettingOptions

Options

PropertyDescriptionTypeDefault
onExitExit full screen trigger() => void-
onEnterEnter full screen trigger() => void-
defaultElementDefault full screen elementElement | HTMLElementhtml

Result

PropertyDescriptionType
isFullscrenIs full screenReadonly<Ref<boolean>>
enterFullscreenEnter full screen() => void
exitFullscreenExit full screen() => void
toggleFullscreenToggle full screen() => void
isEnabledIs enable screenfullboolean

Source

SourceDocsDemo