Loading source
Pulling the file list, source metadata, and syntax-aware rendering for this listing.
Source from repo
Apply VueUse composables in Vue 3/Nuxt projects to replace custom implementations with battle-tested utilities.
Files
Skill
Size
Entrypoint
Format
Open file
Syntax-highlighted preview of this file as included in the skill package.
references/useFullscreen.md
1---2category: Browser3---45# useFullscreen67Reactive [Fullscreen API](https://developer.mozilla.org/en-US/docs/Web/API/Fullscreen_API). It adds methods to present a specific Element (and its descendants) in full-screen mode, and to exit full-screen mode once it is no longer needed. This makes it possible to present desired content—such as an online game—using the user's entire screen, removing all browser user interface elements and other applications from the screen until full-screen mode is shut off.89## Usage1011```ts12import { useFullscreen } from '@vueuse/core'1314const { isFullscreen, enter, exit, toggle } = useFullscreen()15```1617Fullscreen specified element. Some platforms (like iOS's Safari) only allow fullscreen on video elements.1819```vue20<script setup lang="ts">21import { useFullscreen } from '@vueuse/core'22import { useTemplateRef } from 'vue'2324const el = useTemplateRef('el')25const { isFullscreen, enter, exit, toggle } = useFullscreen(el)26</script>2728<template>29<video ref="el" />30</template>31```3233## Component Usage3435```vue36<template>37<UseFullscreen v-slot="{ toggle }">38<video />39<button @click="toggle">40Go Fullscreen41</button>42</UseFullscreen>43</template>44```4546## Type Declarations4748```ts49export interface UseFullscreenOptions extends ConfigurableDocument {50/**51* Automatically exit fullscreen when component is unmounted52*53* @default false54*/55autoExit?: boolean56}57export interface UseFullscreenReturn extends Supportable {58isFullscreen: ShallowRef<boolean>59enter: () => Promise<void>60exit: () => Promise<void>61toggle: () => Promise<void>62}63/**64* Reactive Fullscreen API.65*66* @see https://vueuse.org/useFullscreen67* @param target68* @param options69*/70export declare function useFullscreen(71target?: MaybeElementRef,72options?: UseFullscreenOptions,73): UseFullscreenReturn74```75