Skip to main content

getViewportSize

A function that returns the current Viewport Size. In a server environment, it returns { width: 0, height: 0 }.


Code

🔗 View source code


Interface

typescript
const getViewportSize: () => {
readonly width: number;
readonly height: number;
}

Usage

typescript
import { getViewportSize } from '@modern-kit/utils';

const { width, height } = getViewportSize();