use-mobile
elevenlabs/use-mobileFreeHook
shadcn/ui publishes no description for this item.
Install it
npx shadcn@latest add https://raw.githubusercontent.com/elevenlabs/ui/main/apps/www/public/r/use-mobile.jsonSource
1import * as React from "react"23const MOBILE_BREAKPOINT = 76845export function useIsMobile() {6 const [isMobile, setIsMobile] = React.useState<boolean | undefined>(undefined)78 React.useEffect(() => {9 const mql = window.matchMedia(`(max-width: ${MOBILE_BREAKPOINT - 1}px)`)10 const onChange = () => {11 setIsMobile(window.innerWidth < MOBILE_BREAKPOINT)12 }13 mql.addEventListener("change", onChange)14 setIsMobile(window.innerWidth < MOBILE_BREAKPOINT)15 return () => mql.removeEventListener("change", onChange)16 }, [])1718 return !!isMobile19}
Files it writes
More from shadcn/ui
All 50 items| Component | Registry | Kind | Access | Installs | Command |
|---|---|---|---|---|---|
| use-scribeuse-scribe | shadcn/ui | Hooks | Free | 1 dep | |
| use-transcript-vieweruse-transcript-viewer | shadcn/ui | Hooks | Free | no deps |
