Loading...
Please waitLoading...
Please waitDetect the type of device (mobile, tablet, desktop) and its characteristics with the useDeviceDetect hook, providing a way to adapt UI and functionality based on the device type.
Is Mobile: No
Is Tablet: No
Is Desktop: No
User Agent:
pnpm dlx shadcn@latest add https://usekit.kiron.dev/k/use-device-detect
"use client"
import { useDeviceDetect } from "@/hooks/use-device-detect"
export function Component() {
const { isMobile, isTablet, isDesktop, userAgent } = useDeviceDetect()
return (
<div>
<p>
Device Type: {isMobile ? "Mobile" : isTablet ? "Tablet" : "Desktop"}
</p>
<p>User Agent: {userAgent}</p>
</div>
)
}
Name | Type | Description |
---|---|---|
isMobile | boolean | Indicates if the device is a mobile device. |
isTablet | boolean | Indicates if the device is a tablet. |
isDesktop | boolean | Indicates if the device is a desktop. |
userAgent | string | The user agent string of the device. |