getClientHeight

Commons
stable

Returns the viewport height (window.innerHeight) in a browser context, or the SSR-provided clientHeight fallback when running server-side.

API

Signature

Full TypeScript signature sourced from the util file.

typescript

API

Parameters

Input parameters accepted by this util.

ssr
TSSROptions
Optional SSR options object. When provided as an object with a clientHeight property, that value is returned instead of window.innerHeight.

API

Return value

The value returned by this util.

The viewport height in pixels. Returns 0 when running server-side without an SSR options object.

Usage

Examples

Ready-to-paste usage snippets.

Viewport height in browser vs SSR

typescript