Skip to documentation content

Image Trail

Images that appear and fade along the pointer's path.

image-trail-demo

Overview

Image Trail drops images along the pointer's path as it moves across a section. Each image pops in where the pointer is, holds for a moment, and fades out, so a quick sweep leaves a short trail of work behind it. Use it in a portfolio or studio hero, behind a headline that stays readable on its own.

Three variants are available: scatter tilts and offsets each image a little, stack tilts them alternately and lets each one drift in the direction of travel, and fade keeps them upright and simply fades them.

The component reuses a small pool of images and animates them directly, so moving the pointer does not re-render your React tree.

Installation

npx honestui@latest add image-trail

Usage

import { ImageTrail } from "@/components/animated/image-trail"

<ImageTrail
  images={["/work/01.jpg", "/work/02.jpg", "/work/03.jpg"]}
  className="h-[28rem]"
>
  <h1>Move your cursor</h1>
</ImageTrail>

Images are used in order and repeated. Give the container a height; the trail is clipped to it.

Accessibility

Trail images are decorative. They have empty alt text and sit in a layer hidden from assistive technology, so screen readers only meet the children. Put anything people need, such as links to the work itself, in normal content.

With reduced motion enabled the trail is off and only the children show. Touch drags are ignored by default so touch scrolling keeps working; set touch to follow drags as well, which also stops the section from scrolling under a finger.

API Reference

PropTypeDefaultDescription
images(string | { src: string; alt?: string })[]–Images dropped along the path, in order and repeated.
childrenReactNode–Content shown above the trail.
variantscatter|stack|fade"scatter"How each image enters and leaves.
thresholdnumber80Pointer travel in CSS pixels between two images.
durationnumber1000Milliseconds an image stays, from appearing to gone.
maxVisiblenumber8Most images on screen at once.
imageSizenumber160Image width in CSS pixels.
aspectRationumber0.8Image width over height.
touchbooleanfalseAlso follows touch drags.
classNamestring–Class for the container. Set its height here.
imageClassNamestring–Class for each image, such as a different radius.