{
  "$schema": "https://ui.shadcn.com/schema/registry-item.json",
  "name": "use-is-window-scrolled",
  "title": "useIsWindowScrolled",
  "description": "A hook to check if the window is scrolled",
  "files": [
    {
      "path": "registry/hooks/use-is-window-scrolled.ts",
      "content": "'use client'\n\nimport * as React from 'react'\n\nconst isBrowser = typeof window !== 'undefined'\n\nexport function useIsWindowScrolled(\n  { threshold = 10 }: { threshold?: number } = {},\n) {\n  const scrollTop = isBrowser ? window.scrollY || window.pageYOffset || document.documentElement.scrollTop || 0 : 0\n  const scrollLeft = isBrowser ? window.scrollX || window.pageXOffset || document.documentElement.scrollLeft || 0 : 0\n\n  const [isScrolled, setIsScrolled] = React.useState(scrollTop > threshold || scrollLeft > threshold)\n\n  const handleScrollEvent = React.useEffectEvent(() => {\n    setIsScrolled(scrollTop > threshold || scrollLeft > threshold)\n  })\n\n  React.useEffect(() => {\n    window.addEventListener('scroll', handleScrollEvent, { passive: true })\n\n    return () => {\n      window.removeEventListener('scroll', handleScrollEvent)\n    }\n  }, [threshold])\n\n  return isScrolled\n}\n",
      "type": "registry:hook",
      "target": "hookas/use-is-window-scrolled.ts"
    }
  ],
  "type": "registry:hook"
}