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
| Name | Type | Description | Default |
|---|---|---|---|
| options.debounceMs | number | Debounce milliseconds for resize handler. | 0 |
Returns
| Name | Description |
|---|---|
| { width, height } | Window dimensions. |
Example
const { width } = useWindowSize(); const isMobile = width < 768;Notes
Handles SSR by returning 0/0 when `window` is undefined.