Hooks

useMatchDevice

Detect the device type (mobile, tablet, desktop) from a user agent string. Uses ua-parser-js under the hood — pass the UA from the request on the server or navigator.userAgent on the client.

import { useMatchDevice } from "@empreint/ui";

const { isMobile, isTablet, isDesktop, isMobileOrTablet } = useMatchDevice(
	navigator.userAgent,
);

Parameters

Prop

Type

Returns

Prop

Type