SSE Hooks

useWindowSize

GitHub
Custom hook that tracks the size of the window.

Installation

npx sse-hooks add use-window-size

Usage

example.ts
import { useWindowSize } from "./{hooks file}";

const { width = 0, height = 0 } = useWindowSize();
console.log(`Window size: ${width} x ${height}`);

API

Parameters

Prop Default Type
options-

UseWindowSizeOptions<false>

Returns

Return Value Default Type
height-

T

The height of the window.

width-

T

The width of the window.

Types Aliases

No specific type aliases defined for this component.

Changelog

c165d — feat: enhance useRoleGuard and useSSR hooks with additional options and documentation

30da4 — feat: add new hooks and their metadata

cf13e — feat: add custom hooks for step navigation, ternary dark mode, timeout, toggle, unmount, and window size

Built with Love • © 2026