DOM & Events

useWindowSize

Track window dimensions with automatic updates on resize events.

import { useWindowSize } from "saha-ui"

Uses

Track current window width and height, with optional debounced updates.

Props

NameTypeDescriptionDefault
options.debounceMsnumberDebounce milliseconds for resize handler.0

Returns

NameDescription
{ width, height }Window dimensions.

Example

const { width } = useWindowSize(); const isMobile = width < 768;

Notes

Handles SSR by returning 0/0 when `window` is undefined.
Saha UI - The Modern React Component Library