useIsDesktop

Determines if the current viewport width meets or exceeds a specified desktop breakpoint.

Tip

While this hook is convenient, for simple layout changes, consider using CSS Media Queries first to avoid the "flash of unstyled content" (FOUC) during the initial hydration.

Installation

bash

Description

A responsive utility hook that monitors window resizing and returns a boolean state indicating if the current screen width is greater than or equal to a provided pixel value. It leverages useScreenSize for centralized event listening.

Parameters

NameTypeDescription
widthnumberThe minimum pixel width to consider the device as 'desktop'. Default: 0

Return values

NameTypeDescription
isDesktopbooleantrue if the current viewport width ≥ the parameter width.

Demo

Verifying Desktop View

Current environment📱 Mobile/Tablet View

Source code

tsx