---
title: "Parallax"
description: "Layers that move at their own speed as the page scrolls, and drift toward the mouse. Use it for a hero, a framed picture, or a layer of your own."
url: https://gelatinui.com/components/parallax
markdown_url: https://gelatinui.com/components/parallax.md
access: free
install: "npx shadcn@latest add @gelatin-ui/parallax"
registry_item: https://gelatinui.com/r/parallax.json
version: "2026-11-10"
index: https://gelatinui.com/llms.txt
docs_index: https://gelatinui.com/docs/llms.txt
---

# Parallax

> Layers that move at their own speed as the page scrolls, and drift toward the mouse. Use it for a hero, a framed picture, or a layer of your own.

Page: https://gelatinui.com/components/parallax

## When to use it

Best for: A hero or a section where two or three layers part as the page scrolls, for a sense of depth.

- Put `ParallaxLayer` parts in a `Parallax` root. `speed` sets how fast each one moves: above 0 runs ahead (near), below 0 lags (far).
- Use `range="page"` for a hero at the top of the page, so every layer is at rest when the page loads.
- Give a layer in a clipped frame a `limit` in px, and make it that much larger than the frame, so its edge never shows.
- Add `pointer` to the root and a `depth` to each layer for a drift toward the mouse.

## When not to use it

- For one framed photo that moves slower than the page, use a [Parallax Image](https://gelatinui.com/components/parallax-image.md).
- For a card that turns toward the mouse, use a [Tilt](https://gelatinui.com/components/tilt.md).
- For a part that pulls toward the mouse, use a [Magnetic](https://gelatinui.com/components/magnetic.md).

## Notes for agents

- The root never moves: it is the measured box. Each `ParallaxLayer` owns its `x` and `y`; set the rest with `className` and `style`.
- `speed` is a multiplier: 1 moves 0.2px more per px of scroll, 0 stays with the page.
- `depth` is in px at the edge of the root. A negative depth drifts away from the mouse.
- React does not render while the page scrolls: the layers read Motion values. The work stops off screen.
- `pointer` follows a mouse, a pen, or a finger while it is down. The lift rests the layers, and a finger still scrolls the page.
- `disabled` rests every layer and stops the work.

## Anatomy

```text
Parallax
└─ ParallaxLayer (0..n)
```

## API reference

### Parallax

| Prop | Type | Default | Description |
| --- | --- | --- | --- |
| `range` | `"page" \| "pin" \| "view"` |  | Where the scroll source counts from: `view` (default, the item's own pass through the view), `page` (the page scroll from its top, for a hero), or `pin` (the px a tall section with a sticky stage has pinned). See `PARALLAX_RANGES`. |
| `axis` | `"x" \| "y"` |  | The scroll axis: `y` (default) or `x`. |
| `offset` | `ParallaxOffset` |  | The start and the end of a `view` range in Motion's offset words (`["start 0.9", "end 0.55"]`). Default `PARALLAX_FULL_PASS`: the whole pass through the view. |
| `anchor` | `number` |  | The progress of the `view` range where every layer is at rest, from 0 to 1. Default 0.5: the middle of the range (the middle of the item at the middle of the view for the whole pass). |
| `finishAtEnd` | `boolean` |  | A `view` range that the end of the page cuts short ends at the end of the scroll, so an item near the bottom of the page still reaches progress 1. Default false. |
| `container` | `RefObject<HTMLElement \| null>` |  | The scroll box, when the item scrolls inside one and not with the page. |
| `pointer` | `boolean` |  | Adds the pointer source: the layers drift toward the mouse over the item. Default false. |
| `pointerArea` | `"element" \| "page"` |  | Where the pointer counts: over the item (`element`, default) or the whole page (`page`). |
| `disabled` | `boolean` | false | Rests every layer and stops the work. |

### ParallaxLayer

| Prop | Type | Default | Description |
| --- | --- | --- | --- |
| `speed` | `number` | 1 | How fast the layer moves against the scroll, as a multiplier of the designed pace (1, the default: 20% faster than the page). 1.5 looks nearer, a negative value lags and looks farther, 0 keeps it with the page. |
| `depth` | `number` | 0 | How far the layer drifts toward the mouse at the edge of the root, in px, with `pointer` on the root. A negative depth drifts away from the mouse (a far layer). Default 0. |
| `limit` | `number` |  | The largest scroll offset in px on each side. Give it to a layer in a clipped box (a picture that is 80px larger than its frame: 40), so its edge never shows. |

## Styling

| Part | Slot | States | CSS variables | Tokens |
| --- | --- | --- | --- | --- |
| Parallax | `parallax` |  |  |  |
| ParallaxLayer | `parallax-layer` |  |  |  |

## Usage

Wrap the layers in a `Parallax` root. Give each `ParallaxLayer` a `speed`.

```tsx title="trip-hero.tsx"
import { Parallax, ParallaxLayer } from "@/components/effects/parallax";

export function TripHero() {
  return (
    <Parallax className="grid h-96 place-items-center overflow-clip rounded-3xl">
      <ParallaxLayer speed={-1} limit={48} className="absolute -inset-y-16 inset-x-0">
        <img src="/lake.webp" alt="" className="size-full object-cover" />
      </ParallaxLayer>
      <ParallaxLayer speed={1}>
        <h2 className="text-4xl font-semibold text-white">Seven lakes in seven days</h2>
      </ParallaxLayer>
    </Parallax>
  );
}
```

## 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/parallax
```

It adds 19 registry items: 18 files, 3406 lines, and the npm packages `@base-ui/react`, `@mantine/hooks`, `clsx`, `motion`, `tailwind-merge`.

## 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)
- [Tilt](https://gelatinui.com/components/tilt.md)
- [Magnetic](https://gelatinui.com/components/magnetic.md)
- [Image](https://gelatinui.com/components/image.md)

## Accessibility

Decoration only: it adds no role, no name, and no focus stop. The layers keep the roles, focus, and clicks of their content.

The layers move with `transform` only, so the reading order and the layout never change.

## Motion

| Part | Motion |
| --- | --- |
| Scroll layers | none · each layer follows the scroll in the same frame, with no easing |
| Pointer drift | drift · a soft spring (stiffness 121, damping 22) to each new mouse place, and home when it leaves |
