skip to the page
superthread
componentsuse-mobile
system
superthread
version
2.0.0-next.1
date
25.10.26

use-mobile

a hook that returns true while the window is narrower than 768 px. the sidebar reads it to turn into a sheet on a phone.

bunx --bun shadcn@latest add @mk/use-mobile

example

light

useIsMobile()
false
window
not measured yet

resize the window across 768 px and the value flips.

dark

useIsMobile()
false
window
not measured yet

resize the window across 768 px and the value flips.

upstream

base-nova’s hook, unchanged. the 768 px breakpoint is upstream’s; this site’s own layout changes at 900 and 600 px, in css. the hook returns false until the page hydrates, so markup rendered ahead of time always takes the desktop branch.