---
title: "Parallax Pattern"
description: "A grid, dot, or line pattern behind a section that moves slower than the page."
url: https://gelatinui.com/components/parallax-pattern
markdown_url: https://gelatinui.com/components/parallax-pattern.md
access: pro
install: "npx shadcn@latest add @gelatin-ui-pro/parallax-pattern"
version: "2026-11-10"
index: https://gelatinui.com/llms.txt
docs_index: https://gelatinui.com/docs/llms.txt
---

# Parallax Pattern

> A grid, dot, or line pattern behind a section that moves slower than the page.

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

## When to use it

Best for: A grid, dot, or line pattern that lags behind one section of a landing page.

- Wrap one section. Put its content in `ParallaxPatternContent`, so it paints above the pattern.
- Set the color with `--pattern-color` (and `--pattern-major-color` for the grid) on the root.
- Keep `speed` near 1. Use 2 to make a screenshot or card on top look nearer.
- Pass `container` when the section scrolls inside a box and not with the page.

## When not to use it

- For a pattern that moves on its own with no scroll, use [Dot Matrix](https://gelatinui.com/components/dot-matrix.md).
- For a section that moves in 3D toward the mouse, use [Tilt](https://gelatinui.com/components/tilt.md).

## Notes for agents

- `pattern` is `grid` (24px), `dots` (20px), or `hatch` (12px lines). Default `grid`.
- `speed` is a multiplier: 1 lags 20% behind the page, 0 stays with it, a negative value runs ahead.
- `pointer` adds a drift away from the mouse, `depth` px (default 16). A finger moves it while it is down.
- The layer is taller than the section by its full travel, so its edge never shows. It only translates, with no paint.

## Anatomy

```text
ParallaxPattern
└─ ParallaxPatternContent (0..n)
```

## API reference

### ParallaxPattern

| Prop | Type | Default | Description |
| --- | --- | --- | --- |
| `container` | `RefObject<HTMLElement \| null>` |  | The scroll box, when the item scrolls inside one and not with the page. |
| `pointer` | `boolean` | false | Adds the pointer source: the layers drift toward the mouse over the item. Default false. |
| `disabled` | `boolean` |  | Rests every layer and stops the work. |
| `pattern` | `"dots" \| "grid" \| "hatch"` |  |  |
| `speed` | `number` | 1 | How far the pattern lags behind the page, as a multiplier of the designed lag (1, the default: 20% slower than the page, so it looks far behind the content). 2 lags twice as much, 0 keeps it with the page, and a negative value runs ahead of it. |
| `depth` | `number` | 16 | px the pattern drifts away from the mouse at the edge of the box, with `pointer`. Default 16. A negative depth drifts toward the mouse. |

### ParallaxPatternContent

No props of its own: `className`, `children`, and every other prop go to the element it renders.

## Styling

| Part | Slot | States | CSS variables | Tokens |
| --- | --- | --- | --- | --- |
| ParallaxPattern | `parallax-pattern` |  |  | `pattern` |
| ParallaxPatternContent | `parallax-pattern-content` |  |  |  |

## Usage

Wrap a section. Put its content in `ParallaxPatternContent`, so only the pattern moves.

```tsx title="stats-section.tsx"
import {
  ParallaxPattern,
  ParallaxPatternContent,
} from "@/components/pro/effects/parallax-pattern";

export function StatsSection() {
  return (
    <ParallaxPattern pattern="dots" className="border-y">
      <ParallaxPatternContent className="mx-auto max-w-xl px-6 py-24">
        <h2 className="text-3xl font-medium">Fast on the first request</h2>
      </ParallaxPatternContent>
    </ParallaxPattern>
  );
}
```

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

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

## Built on

- [Parallax](https://gelatinui.com/components/parallax.md)

## 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](https://gelatinui.com/components/parallax.md)
- [Dot Matrix](https://gelatinui.com/components/dot-matrix.md)
- [Tilt](https://gelatinui.com/components/tilt.md)
- [Card](https://gelatinui.com/components/card.md)

## Motion

| Part | Motion |
| --- | --- |
| Drift | none · 1:1 with the scroll, the pattern moves slower than the page |
