@hyperfrontend/ui-utils/mobile

mobile

Mobile-device detection helper.

isMobileDevice() returns true when the current runtime appears to be a mobile browser based on user-agent and feature signals. Use it to gate behavior that only makes sense on touch-first devices (gesture listeners, larger hit-targets, mobile-only UI) without depending on a full UA-parsing library.

API Reference

ƒ Functions

§function

isMobileDevice(): boolean

Detects whether the current device is a mobile device based on the user agent.

Returns

boolean
True if the device is mobile, false otherwise

Example

Detecting mobile device

if (isMobileDevice()) {
  showMobileLayout()
} else {
  showDesktopLayout()
}