Copies›Hover Reel

Hover Reel

A list of projects: point at a title and a picture blooms under the cursor and follows it; move to another row and the pictures roll past inside the frame instead of swapping. Copia adds a frame that leans into fast moves, a round "View" badge riding it in a colour of your choice, theme colours and inline pictures on touch screens.

Copy a ready prompt for Claude Code, Codex or Cursor

Seen on

Dennis Snellenberg

Dependencies

reacttailwindcss

Interaction type

hovercursorkeyboard

Install via CLI

pnpm dlx shadcn@latest add @copia/hover-reel

Without the namespace: npx shadcn@latest add https://copia-ui.vercel.app/r/hover-reel.json

How to use

demo.tsx
"use client"

import { HoverReel, type HoverReelProps } from "./hover-reel"

const shot = (file: string) => `/demo/hover-reel/${file}.webp`

const PROJECTS = [
  { title: "Masar", label: "Trip planning for Oman", image: shot("modern-building-corner") },
  { title: "Wally", label: "A household wallet", image: shot("minimalist-geometric-composition") },
  { title: "TransOcean", label: "Logistics platform", image: shot("monochromatic-staircase") },
  { title: "OCS", label: "Website and design system", image: shot("modern-workspace-setup") },
  { title: "Vitrine", label: "Component library", image: shot("abstract-toroidal-form") },
]

/** Customizer values (width, tilt, badge colours) flow into the reel. */
export default function Demo(props: Pick<HoverReelProps, "width" | "tilt" | "cursorColor" | "cursorTextColor">) {
  return (
    <div className="flex flex-1 flex-col justify-center py-12">
      <div className="mx-auto w-full max-w-[72rem] px-[clamp(1.25rem,5vw,4rem)]">
        <p className="mb-6 font-mono text-[11px] tracking-[0.16em] text-muted-foreground uppercase">Selected work · 2023–2026</p>
        <HoverReel projects={PROJECTS} {...props} />
      </div>
    </div>
  )
}

Customization

Use the sliders button at the top right of the preview to tweak width, tilt, cursorColor, cursorTextColor live and copy the generated JSX.

Props

PropTypeDefaultDescription
projects{ title, label, image, href? }[]-Rows in order; image is the picture shown on hover.
widthnumber320Frame width in px; height follows at 16:10.
cursorLabelstring"View"Text on the round badge riding the frame; empty hides it.
tiltnumber6Max degrees the frame leans into fast horizontal moves; 0 keeps it upright.
cursorColorstring"#455ce9"Badge colour (Dennis Snellenberg's cursor blue).
cursorTextColorstring"#ffffff"Badge text colour.

Attribution

Inspired by Dennis Snellenberg, Olivier Larose (Project Gallery tutorial). Recreated by Copia.

Demo images by mikiwa, ricardomatos, viridianagdz, cayetanogros, ui.jaymez.

Read how it was reverse engineered

Source code

hover-reel.tsx
"use client"

import { useEffect, useRef, useState } from "react"
import { cn } from "@/lib/utils"

export type ReelProject = {
  title: string
  label: string
  image: string
  href?: string
}

export type HoverReelProps = {
  projects: ReelProject[]
  /** Frame width in px; the height follows at 10:16. */
  width?: number
  /** Text on the round badge riding the frame. Empty hides it. */
  cursorLabel?: string
  /** Degrees the frame leans into fast horizontal moves. 0 keeps it upright. */
  tilt?: number
  /** Badge colour; Dennis Snellenberg's cursor blue by default. */
  cursorColor?: string
  /** Badge text colour. */
  cursorTextColor?: string
  className?: string
}

// Dennis Snellenberg's work list: the frame scales in on this curve and the strip rolls on it too.
const EASE = "cubic-bezier(0.76, 0, 0.24, 1)"
const FOLLOW = 0.16 // share of the remaining distance the frame covers each frame
const INSET = 16 // px the frame keeps from the list's edges

/**
 * A list of projects. Point at a title and a picture blooms under the cursor
 * and follows it; move to another row and the pictures roll past inside the
 * frame instead of swapping. Touch screens show a small picture inline.
 */
export function HoverReel({ projects, width = 320, cursorLabel = "View", tilt = 6, cursorColor = "#455ce9", cursorTextColor = "#ffffff", className }: HoverReelProps) {
  const host = useRef<HTMLDivElement>(null)
  const frame = useRef<HTMLDivElement>(null)
  const [active, setActive] = useState(-1)
  const [open, setOpen] = useState(false)
  const height = Math.round((width * 10) / 16)

  // The frame chases the pointer with an eased lerp, leans into its speed, and sleeps when it arrives.
  useEffect(() => {
    const el = host.current
    const f = frame.current
    if (!el || !f) return
    const reduced = matchMedia("(prefers-reduced-motion: reduce)").matches
    const s = { x: 0, y: 0, tx: 0, ty: 0, lean: 0, raf: 0, placed: false }
    const write = () => {
      f.style.translate = `${s.x}px ${s.y}px`
      f.style.rotate = `${s.lean}deg`
    }
    const tick = () => {
      s.raf = 0
      const k = reduced ? 1 : FOLLOW
      const dx = (s.tx - s.x) * k
      s.x += dx
      s.y += (s.ty - s.y) * k
      // Copia: lean toward the direction of travel, proportional to speed.
      s.lean = reduced ? 0 : Math.max(-tilt, Math.min(tilt, dx * 0.35))
      write()
      if (Math.abs(s.tx - s.x) + Math.abs(s.ty - s.y) > 0.3) s.raf = requestAnimationFrame(tick)
      else if (s.lean !== 0) {
        s.lean = 0
        write()
      }
    }
    const aim = (cx: number, cy: number) => {
      const r = el.getBoundingClientRect()
      const w = f.offsetWidth
      const h = f.offsetHeight
      s.tx = Math.max(INSET, Math.min(el.offsetWidth - w - INSET, cx - r.left - w / 2))
      s.ty = Math.max(INSET, Math.min(el.offsetHeight - h - INSET, cy - r.top - h / 2))
      if (!s.placed) {
        s.x = s.tx
        s.y = s.ty
        s.placed = true
        write()
      }
      if (!s.raf) s.raf = requestAnimationFrame(tick)
    }
    const onMove = (e: PointerEvent) => e.pointerType === "mouse" && aim(e.clientX, e.clientY)
    const onLeave = () => {
      s.placed = false
      setOpen(false)
    }
    // Keyboard focus parks the frame at the right of the focused row.
    const onFocus = (e: FocusEvent) => {
      const row = (e.target as HTMLElement).closest<HTMLElement>("[data-row]")
      if (!row || !row.matches(":focus-visible")) return
      const r = row.getBoundingClientRect()
      s.placed = false
      aim(r.right - f.offsetWidth / 2 - 24, r.top + r.height / 2)
    }
    el.addEventListener("pointermove", onMove)
    el.addEventListener("pointerleave", onLeave)
    el.addEventListener("focusin", onFocus)
    return () => {
      cancelAnimationFrame(s.raf)
      el.removeEventListener("pointermove", onMove)
      el.removeEventListener("pointerleave", onLeave)
      el.removeEventListener("focusin", onFocus)
    }
  }, [tilt])

  return (
    <div ref={host} className={cn("relative w-full", className)}>
      <ul className="border-t border-border" onBlur={(e) => !e.currentTarget.contains(e.relatedTarget as Node) && setOpen(false)}>
        {projects.map((p, i) => {
          const lit = open && active === i
          return (
            <li key={p.title} className="border-b border-border">
              <a
                data-row
                href={p.href ?? "#"}
                onPointerEnter={(e) => {
                  if (e.pointerType !== "mouse") return
                  setActive(i)
                  setOpen(true)
                }}
                onFocus={() => {
                  setActive(i)
                  setOpen(true)
                }}
                onClick={(e) => !p.href && e.preventDefault()}
                className="group flex items-center gap-4 py-7 outline-none focus-visible:ring-2 focus-visible:ring-ring sm:py-9"
              >
                {/* Touch screens have no hover: a small picture sits inline instead. */}
                {/* eslint-disable-next-line @next/next/no-img-element -- plain img keeps the component framework-agnostic */}
                <img src={p.image} alt="" className="hidden aspect-[16/10] w-20 shrink-0 rounded-sm object-cover [@media(pointer:coarse)]:block" />
                <span
                  className={cn(
                    "text-4xl font-normal tracking-[-0.04em] transition-[translate,opacity] duration-500 sm:text-6xl",
                    open && !lit && "opacity-35",
                    lit && "-translate-x-2.5",
                  )}
                  style={{ transitionTimingFunction: EASE }}
                >
                  {p.title}
                </span>
                <span
                  className={cn("ml-auto text-right text-sm text-muted-foreground transition-[translate,opacity] duration-500", open && !lit && "opacity-35", lit && "translate-x-2.5")}
                  style={{ transitionTimingFunction: EASE }}
                >
                  {p.label}
                </span>
              </a>
            </li>
          )
        })}
      </ul>

      <div ref={frame} aria-hidden className="pointer-events-none absolute top-0 left-0 z-10 [@media(pointer:coarse)]:hidden" style={{ width, height }}>
        <div
          className="size-full overflow-hidden rounded-sm bg-muted transition-[scale] duration-[400ms]"
          style={{ scale: open ? "1" : "0", transitionTimingFunction: EASE }}
        >
          <div className="size-full transition-[translate] duration-500" style={{ translate: `0 ${-100 * Math.max(0, active)}%`, transitionTimingFunction: EASE }}>
            {projects.map((p) => (
              // eslint-disable-next-line @next/next/no-img-element -- plain img keeps the component framework-agnostic
              <img key={p.title} src={p.image} alt="" className="block size-full object-cover" />
            ))}
          </div>
        </div>
        {/* Copia: a round badge rides the frame, after Dennis Snellenberg's "View" cursor. */}
        {cursorLabel && (
          <span
            className="absolute top-1/2 left-1/2 grid size-20 -translate-1/2 place-items-center rounded-full text-sm font-medium transition-[scale] duration-[400ms]"
            style={{ background: cursorColor, color: cursorTextColor, scale: open ? "1" : "0", transitionTimingFunction: EASE, transitionDelay: open ? "60ms" : "0ms" }}
          >
            {cursorLabel}
          </span>
        )}
      </div>
    </div>
  )
}

Keep in mind

Most components here are recreations of the best interfaces out there. We don't claim to be the original creators: this is our attempt to reverse engineer, replicate and often add a few features. We credit everyone we can; if we missed someone, let us know.

Contact

Found a bug or a missing credit? Open an issue

License & usage

  • — Free to use and modify in personal and commercial projects (MIT).
  • — No attribution required, but a link back to Copia is appreciated.
  • — Demo images are not part of the license; replace them with your own.
PreviousCopy ButtonNext Inverted Perspective Carousel

Selected work · 2023–2026

  • MasarTrip planning for Oman
  • WallyA household wallet
  • TransOceanLogistics platform
  • OCSWebsite and design system
  • VitrineComponent library
View