Report a problem or share feedback← Catalog
Scroll Direction: Hide Header
curatedfreemotion/scroll-hide-header
A sticky header that hides when scrolling down and reappears when scrolling up. Uses useMotionValueEvent to detect scroll direction.
$
pnpm add motion # then adapt the free source from https://motion.dev/examples/react-scroll-hide-headernpm deps: motion
Our notes
Header that hides on scroll down and returns on scroll up (useMotionValueEvent). Great default for marketing navbars. Free example (motion is MIT); copy and adapt the source from the example page.
- Source
- Motion (motion.dev)
- Kind
- transition
- Categories
- transition, scroll-effect
- Use as
- recipe — technique you apply to your own markup
- Applies to
- navigation
- Motion
- on scroll · subtle · motion · low cost
- Tags
- motion, useScroll, useMotionValueEvent, animate
- Licence
- motion / motion/react / motion-v are MIT. Motion+ (premium components, example source, AI Kit pro tools) is paid — one-time Personal licence or per-seat Business.
- Live demo
- motion.dev
- Docs
- motion.dev
Similar
Compare all 4 →- Track element within viewportmotion/scroll-track-element-in-viewportAn example of tracking an element within the viewport using Motion for React's useScroll hook.
- Scroll-linked animationsmotion/scroll-linkeduseScroll + useTransform: progress bars and parallax tied to scroll position. Medium-intensity; keep it to one element per viewport. Free example (motion is MIT); copy and adapt the source from the example page.
- Element scroll-linked animationmotion/scroll-containerAn example of a scroll-linked animation using a specific element's scroll position using Motion for React's useScroll hook.