Infinity x Infinity

useWindowSize

Reactive window size

Usage

import { useWindowSize } from '@vueuse/core'

const { width, height } = useWindowSize()

Type Declarations

export interface WindowSizeOptions extends ConfigurableWindow {
  initialWidth?: number
  initialHeight?: number
}
/**
 * Reactive window size.
 *
 * @see /useWindowSize
 * @param options
 */
export declare function useWindowSize({
  window,
  initialWidth,
  initialHeight,
}?: WindowSizeOptions): {
  width: Ref<number>
  height: Ref<number>
}

Source

SourceDemoDocs