react-device-meta-hook
Version:
A lightweight React hook that detects the user's browser, operating system, device type (mobile, tablet, desktop), screen orientation, and resolution. It automatically adds meaningful CSS classes to the `<html>` element, enabling responsive design and con
23 lines (21 loc) • 505 B
TypeScript
interface DeviceInfo {
browser: {
name: string;
version: string;
};
os: string;
deviceType: "mobile" | "tablet" | "desktop";
orientation: "portrait" | "landscape";
resolution: {
width: number;
height: number;
};
viewportHeights?: {
dvh: number;
lvh: number;
svh: number;
};
}
declare const useDeviceDetect: (callback?: (info: DeviceInfo) => void) => void;
export { useDeviceDetect };
export type { DeviceInfo };