Back to Vueuse

useWindowSize

packages/core/useWindowSize/index.md

14.3.0438 B
Original Source

useWindowSize

Reactive window size

Usage

vue
<script setup lang="ts">
import { useWindowSize } from '@vueuse/core'

const { width, height } = useWindowSize()
</script>

<template>
  <div>
    Width: {{ width }}
    Height: {{ height }}
  </div>
</template>

Component Usage

vue
<template>
  <UseWindowSize v-slot="{ width, height }">
    Width: {{ width }}
    Height: {{ height }}
  </UseWindowSize>
</template>