Image Trail

Photos drop along the pointer's path and lift away a moment later.

PROGet Image Trail and 168 other Pro components with pro lifetime — Get Pro

Category
Creative
Access
Pro
Source
140 lines · one file
States
4 drawn

The decision inside it

Distance, not time, decides when a photo drops

A new photo lands each time the pointer has moved far enough, so a slow move lays a neat path, a fast one a scattered spread, and a still pointer never piles photos up. Only a handful are on screen at once, and each leaves on its own so the trail reads in the direction you moved.

When to use it

Use Image Trail for a portfolio or studio section browsed by moving the pointer: photos drop along its path and lift away. Six to twelve images work best.

Installation

How you get it

Paste this into Claude Code, Cursor, Codex or any coding agent. It installs the file and uses it as it is, instead of writing a new one.

Use Liro's Image Trail for this.
Install it: npx shadcn@latest add @liro/image-trail
(the @liro registry is set up in components.json, with LIRO_KEY in .env.local)
Import it from @/components/ui/image-trail.
Do not rewrite or restyle it. Pass my data through its props
and keep its built-in states.

For the full brief with every prop and the mistakes assistants usually make, use Copy prompt above. Pro components install through the @liro registry with your CLI token: see the Namespaced tab.

Usage

components/work.tsx
import { ImageTrail } from "@/components/ui/image-trail";

const work = [{ src: "/work/casa-sal.jpg" }, { src: "/work/long-curve.jpg" }, { src: "/work/rojo.jpg" }];

export function Work() {
  return (
    <ImageTrail images={work} className="h-[480px]">
      <div className="flex h-full items-center justify-center">
        <h2 className="text-5xl font-bold tracking-tight">Places we have made.</h2>
      </div>
    </ImageTrail>
  );
}

API reference

“Copy prompt” above puts a full brief on your clipboard, install command, dependencies, props, and the mistakes an assistant usually makes with this component.

Props

Read from the component’s own TypeScript interface when the site is built, so this table cannot drift from the file you install.

TypeNotes
imagesTrailImage[] Yes–
sizenumber NoWidth of each photo, in px. Height follows at 5:4. Default 168.
spacingnumber NoPointer travel between photos, in px. Default 110.
lingernumber NoHow long a photo stays before it lifts away, in ms. Default 900.
maxnumber NoMost photos on screen at once. Default 6.

Dependencies

npm packages

clsxframer-motiontailwind-merge

Liro foundations, installed alongside it

liro-theme

States

All of them are drawn by the component. None is left for you to design.

  • Resting
  • Trailing
  • Touch drag
  • Reduced motion

Accessibility

  • Keyboard reachable throughout, in visual order
  • Focus trapped in overlays, Escape closes them
  • Focus returns to whatever opened it
  • Live regions announce what changed, not that something did
  • Honours prefers-reduced-motion

Responsive behavior

  • Sizes to its container, not the viewport
  • Usable from 320px up
  • Pointer-based interaction, so trackpad and touch both work
  • No hover-only affordances