Skip to Content
⭐️ Leave a star →
HooksuseWindowSize

useWindowSize

Returns the live { width, height } of the viewport. SSR-safe — returns { width: 0, height: 0 } until the first client measurement.

import { useWindowSize } from '@wire-ui/react' function Viewport() { const { width, height } = useWindowSize() return <span>{width} × {height}</span> }

Returns

{ width: number, height: number } — reactive object that updates on resize and orientationchange.
Last updated on

MIT License © 2026 wire-ui

useWindowSize – Wire UI