Motion

Track element within viewport

Component 18

About

An example of tracking an element within the viewport using Motion for React's useScroll hook.

Built with React and Tailwind. Copy the prompt and paste it into Claude Code, Cursor or Lovable: your agent adds Track element within viewport to your project and fits it to your theme.

Code

How Track element within viewport is used: the demo's code. The component's own source comes with a free account.

Usage.tsx

"use client"

import TrackElementWithinViewport from "@/components/ui/motion-scroll-track-element"

export default function Default() {
  return (
    <div className="motion-example flex w-full items-center justify-center p-4">
      <TrackElementWithinViewport />
    </div>
  )
}

Dependencies

More by Motion

View all
  • Material design ripple

    Material design ripple

    626
  • Scroll word reveal

    Scroll word reveal

    265
  • Confetti

    Confetti

    211
  • Floating Action Button

    Floating Action Button

    122
  • Scroll Horizontal Gallery

    Scroll Horizontal Gallery

    92
  • Split text

    Split text

    79
  • Fill text

    Fill text

    79
  • Scramble text

    Scramble text

    67