---
title: "Image Trail"
description: "Moving the pointer leaves a trail of photos that pop in and go, in five styles. A slow path draws the trail when no pointer is there."
url: https://gelatinui.com/components/image-trail
markdown_url: https://gelatinui.com/components/image-trail.md
access: pro
install: "npx shadcn@latest add @gelatin-ui-pro/image-trail"
version: "2026-11-18"
index: https://gelatinui.com/llms.txt
docs_index: https://gelatinui.com/docs/llms.txt
---

# Image Trail

> Moving the pointer leaves a trail of photos that pop in and go, in five styles. A slow path draws the trail when no pointer is there.

Page: https://gelatinui.com/components/image-trail

## When to use it

Best for: A large hero or section where a set of photos adds mood behind a short headline.

- Give the root a height, and pass small photos of about twice `imageWidth`.
- Put the headline and the actions in the children. They render above the photos and stay clickable.
- Use `variant` to set how a photo moves: `drift`, `stack`, `reveal`, `fall`, or `elastic`.
- Set `idle="none"` when the area must stay empty until the pointer comes.

## When not to use it

- For photos that people must see, browse, and read one by one, use a [Carousel](https://gelatinui.com/components/carousel.md).
- For one photo that moves with the page scroll, use [Parallax Image](https://gelatinui.com/components/parallax-image.md).

## Notes for agents

- `ImageTrail` is one root with no parts. `images` is required, and each image is `{ src, alt? }`.
- The root needs a height from `className`, or the area has no size.
- A photo that fails to load leaves the cycle. `onImageError` reports it, with the image and its index.
- `lifetime` does not act on `stack` or `fall`. `maxTilt` does not act on `reveal` or `elastic`.
- A photo that lands within half a photo of the last one waits 167 ms, so one place changes at most six times a second.
- The trail stops off screen and in a hidden tab. Photos on screen finish their own motion.

## Anatomy

```text
ImageTrail
```

## API reference

### ImageTrail

| Prop | Type | Default | Description |
| --- | --- | --- | --- |
| `variant` | `ImageTrailVariant` | "drift" | How each photo moves: `drift` (default) floats on and fades, `stack` drops prints that stay, `reveal` opens a window, `fall` drops under gravity, and `elastic` stretches and springs back. |
| `rounded` | `"default" \| "full"` | "default" | The photo corners: `default` (8px, 4px for `stack`) or `full` (circles with a square photo). |
| `images` | `readonly ImageTrailImage[]` |  | The photos, shown in order along the trail. Pass small versions (about twice `imageWidth`): a photo never shows larger than that. |
| `imageWidth` | `number` | 168 | Photo width in px, 1 or more. Default 168. |
| `aspectRatio` | `number` | 4 / 5 | Photo width divided by height, 0.1 or more. Default 4 / 5. |
| `spacing` | `number` | 90 | Pointer travel between two photos, in px, 8 or more. Default 90. A photo that would land on the last one waits, so a small value on a fast move leaves about half a photo between drops. |
| `lifetime` | `number` | 900 | How long a photo stays, in ms, 300 or more. Default 900. `stack` prints stay until the pool needs them, and `fall` photos stay until they leave the bottom edge, so both skip it. |
| `maxTilt` | `number` | 10 | The largest lean in degrees, at full sideways speed. Default 10. `drift` and `fall` use all of it, `stack` half, and `reveal` and `elastic` stay upright. |
| `poolSize` | `number` | 14 | How many photos can be on screen at once: the node pool, 2 to 60. Default 14. |
| `idle` | `ImageTrailIdle` | "autopilot" | With no pointer: `autopilot` (default) draws a slow figure eight, so the area looks complete at rest; `none` leaves it empty. Keyboard focus inside runs the autopilot around the focused element in both cases. |
| `disabled` | `boolean` | false | No new photos and no autopilot; touch scrolling goes back to the page. Default false. |
| `onImageError` | `function` |  | Called when a photo fails to load or decode. The trail skips it. |

Also takes every prop of Base UI `UseRender`: https://base-ui.com/react/components/use-render

## Styling

| Part | Slot | States | CSS variables | Tokens |
| --- | --- | --- | --- | --- |
| ImageTrail | `image-trail` | `data-disabled` |  |  |

## Usage

Give the root a height and the photos. The children sit above the trail.

The sample also uses `button`, which this add does not write. One command adds them with this item:

```bash
npx shadcn@latest add @gelatin-ui-pro/image-trail @gelatin-ui/button
```

```tsx title="travel-hero.tsx"
import { ImageTrail } from "@/components/pro/effects/image-trail";
import { Button } from "@/components/ui/button";

const photos = [
  { src: "/example-assets/mountains-above-clouds-4x5.webp", alt: "Soft peaks above clouds" },
  { src: "/example-assets/turquoise-lake-boat-4x5.webp", alt: "A boat on a calm lake" },
  { src: "/example-assets/hills-sunrise-4x5.webp", alt: "A lone tree at sunrise" },
  { src: "/example-assets/pine-path-4x5.webp", alt: "A path between tall pines" },
];

export function TravelHero() {
  return (
    <ImageTrail
      images={photos}
      variant="drift"
      className="flex h-96 flex-col items-center justify-center gap-4 rounded-xl bg-muted"
    >
      <h2 className="text-4xl font-light text-white mix-blend-difference">
        Walk the quiet valleys
      </h2>
      <Button variant="secondary">See the routes</Button>
    </ImageTrail>
  );
}
```

## Compose

Rules:

- Compose the parts (`compose-parts`): Build each item from its named parts as children, and pass your text and icons in as parts.
- Every state is designed (`every-state`): Give each view of data its loading, empty, and error states: a skeleton in the final layout, an `Empty` with an illustration and one next action, and an error that says what failed and how to retry.

## Add it

```bash
npx shadcn@latest add @gelatin-ui-pro/image-trail
```

It adds 22 registry items: 22 files, 3228 lines, and the npm packages `@base-ui/react`, `@mantine/hooks`, `@xstate/react`, `motion`, `tailwind-merge`, `tailwind-variants`, `xstate`.

## For AI agents

- Every item, one file: https://gelatinui.com/llms.txt
- MCP server (`search_items`, `get_item`, `get_install_plan`): https://gelatinui.com/mcp

## Related

- [Parallax Image](https://gelatinui.com/components/parallax-image.md)
- [Mask Reveal](https://gelatinui.com/components/mask-reveal.md)
- [Image](https://gelatinui.com/components/image.md)

## Keyboard

| Keys | Action |
| --- | --- |
| Tab | Moves to a control in the children. The slow path then circles that control, also with `idle="none"`. |

## Accessibility

The photo layer is `aria-hidden`: the trail is decoration, and screen readers read only the children.

Keyboard focus on a control in the children starts the slow path around that control.

The root sets `touch-action: pan-y`: a sideways drag draws, and an up or down swipe scrolls the page. `disabled` gives touch back to the page.

## Motion

| Part | Motion |
| --- | --- |
| Photo pop | follow · spring · the photo grows from 60% with a start speed |
| Drift and elastic fade | progress · `lifetime` (900ms by default) · the last 40% fades the photo |
| Stack leave | fade-exit · the oldest print fades and shrinks to 90% when the pool needs it |
| Reveal open | panel · a window opens from the middle while the photo settles from 130% |
| Reveal close | revealExit · the window closes to the middle |
| Elastic stretch | elastic · a bouncy spring (stiffness 420, damping 12) takes the stretch back to 100% |
| Fall | progress · up to 2.4s · gravity of 2400 px/s² pulls the photo past the bottom edge |
| Slow path | progress · 6s · a figure eight with no pointer, 1.5s after the pointer leaves |
