---
title: "Frame Scrub"
description: "A pinned section where a sequence of pictures plays frame by frame as the page scrolls, forward and back."
url: https://gelatinui.com/components/frame-scrub
markdown_url: https://gelatinui.com/components/frame-scrub.md
access: pro
install: "npx shadcn@latest add @gelatin-ui-pro/frame-scrub"
version: "2026-11-10"
index: https://gelatinui.com/llms.txt
docs_index: https://gelatinui.com/docs/llms.txt
---

# Frame Scrub

> A pinned section where a sequence of pictures plays frame by frame as the page scrolls, forward and back.

Page: https://gelatinui.com/components/frame-scrub

## When to use it

Best for: A short film of 60 to 120 frames that a person plays with the scroll, forward and back.

- Give `FrameScrubCanvas` the frame files in order and an `alt` that says what the film shows.
- Put the heading and the call to action in `FrameScrubContent`: it holds still while the frames play.
- Make the root taller with `className` (`h-[400svh]`) for a slower film.
- In a scroll box, pass the box as `container` and set its height with `--parallax-view`.

## When not to use it

- For a real video clip with smooth motion, use [Video Scrub](https://gelatinui.com/components/video-scrub.md).
- For one picture that moves a little slower than the page, use [Parallax Image](https://gelatinui.com/components/parallax-image.md).

## Notes for agents

- The root is three views tall (`h-[calc(var(--parallax-view,100svh)*3)]`); the stage sticks for the extra two views.
- Frames load near the view: the first and the last, then the halves of the gaps, 6 at a time.
- Each decoded frame stays in memory: 60 frames of 640 × 360 are about 55 MB. Use 640 to 1280 px wide frames.
- `fit` is `cover` (default) or `contain`. `poster` sets the still picture; the default is the first frame.
- `disabled` shows the still picture, loads no other frame, and does no scroll work.
- The canvas draws only when the frame changes, so a still page draws nothing.

## Anatomy

```text
FrameScrub
├─ FrameScrubCanvas (0..n)
└─ FrameScrubContent (0..n)
```

## API reference

### FrameScrub

| Prop | Type | Default | Description |
| --- | --- | --- | --- |
| `container` | `RefObject<HTMLElement \| null>` |  | The scroll box, when the item scrolls inside one and not with the page. |
| `disabled` | `boolean` | false | Rests every layer and stops the work. |

### FrameScrubCanvas

| Prop | Type | Default | Description |
| --- | --- | --- | --- |
| `frames` | `readonly string[]` |  | The frame files in order, the first frame at the start of the pin. |
| `alt` | `string` |  | Say what the sequence shows: the text of the still picture under the canvas. |
| `fit` | `"contain" \| "cover"` | "cover" | `cover` (default) crops the frames to fill the stage; `contain` shows each frame whole. |
| `poster` | `string` |  | The still picture before the canvas draws, and the fallback. Default: the first frame. |

### FrameScrubContent

| Prop | Type | Default | Description |
| --- | --- | --- | --- |
| `scrim` | `boolean` | true | A dark fade from the bottom under the text, so it reads on any frame. Default true. Without it, give the text its own backdrop. |

## Styling

| Part | Slot | States | CSS variables | Tokens |
| --- | --- | --- | --- | --- |
| FrameScrub | `frame-scrub` |  | `--parallax-pin-top`, `--parallax-view` |  |
| FrameScrubCanvas | `frame-scrub-canvas` |  |  |  |
| FrameScrubContent | `frame-scrub-content` |  |  |  |

## Usage

Give the frames in order. Put the text over them in the content part.

```tsx title="coast-film.tsx"
import {
  FrameScrub,
  FrameScrubCanvas,
  FrameScrubContent,
} from "@/components/pro/effects/frame-scrub";

const frames = Array.from({ length: 60 }, (_, index) => {
  return `/frames/coast-${String(index + 1).padStart(2, "0")}.webp`;
});

export function CoastFilm() {
  return (
    <FrameScrub>
      <FrameScrubCanvas frames={frames} alt="The camera sinks from the sky to a hiker on the cliff path" />
      <FrameScrubContent>
        <h2 className="text-4xl font-medium">Down to the cliff path</h2>
      </FrameScrubContent>
    </FrameScrub>
  );
}
```

## 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/frame-scrub
```

It adds 39 registry items: 37 files, 6004 lines, and the npm packages `@base-ui/react`, `@mantine/hooks`, `@phosphor-icons/react`, `@unpic/core`, `@xstate/react`, `clsx`, `motion`, `tailwind-merge`, `tailwind-variants`, `xstate`.

## Built on

- [Image](https://gelatinui.com/components/image.md)
- [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)
- [Parallax Image](https://gelatinui.com/components/parallax-image.md)
- [Image](https://gelatinui.com/components/image.md)

## Accessibility

The still picture under the canvas keeps the `alt` text; the canvas is hidden from screen readers.

The content holds still on the stage, so a focus that lands in it is always in sight.

## Motion

| Part | Motion |
| --- | --- |
| Scroll | none · the frame follows the scroll in the same frame, with no easing |
| Canvas in | fade · 150ms, the canvas fades in over the still picture after its first frame |
