---
title: "Text Fold"
description: "Text folded into bands like a sheet of paper. It unfolds as it scrolls into view and folds again under the mouse."
url: https://gelatinui.com/components/text-fold
markdown_url: https://gelatinui.com/components/text-fold.md
access: pro
install: "npx shadcn@latest add @gelatin-ui-pro/text-fold"
version: "2026-11-14"
index: https://gelatinui.com/llms.txt
docs_index: https://gelatinui.com/docs/llms.txt
---

# Text Fold

> Text folded into bands like a sheet of paper. It unfolds as it scrolls into view and folds again under the mouse.

Page: https://gelatinui.com/components/text-fold

## When to use it

Best for: A short title of one or two lines that unfolds as its section scrolls into view.

- Wrap the text of a heading. Every element is a `span`, so it is valid in an `h1` or `h2`.
- Use `trigger="scroll"` (default) to tie the unfold to the scroll place, `view` for one unfold the first time it is on screen, or `mount` for one unfold at once.
- Use `slats` (2 to 12, default 4) for the number of bands, `angle` (default 80) for the turn of each band, and `perspective` (default 800px) for the 3D view.
- Use `range` to move where the scroll unfold starts and ends in the view, and `container` when the text scrolls inside a box.
- Use `refold` (0 to 1) to fold it again while the mouse is on it, or while keyboard focus is on a link or button around it.

## When not to use it

- For lines of a text at different depths on a plane that turns, use [Text Perspective](https://gelatinui.com/components/text-perspective.md).
- For layers that move at their own speed as the page scrolls, use [Parallax](https://gelatinui.com/components/parallax.md).
- For body text or a long paragraph that people must read, use plain text.

## Notes for agents

- `children` must be a string. The text folds as one sheet, across all its lines.
- The real text sits under the bands, transparent: a screen reader reads it once, and it selects, copies, and is found once. The band copies are `aria-hidden` and take no pointer.
- Each band is one more copy of the text to paint, so `slats` stops at 12. A value that is not a number takes the default.
- React does not render while the page scrolls: one Motion value writes the fold as a custom property, and each band turns in CSS. The server HTML has the right fold, so the text does not jump on load.
- Default `range` is `[1, 0.6]`: the unfold starts when the top of the text is at the bottom of the view and ends when its middle is at 60%. Near the end of a page, it is flat at the end of the scroll.
- The mouse refold runs only on a device with a mouse, so a tap on a phone does not leave it folded.
- A word wider than the line breaks, so a long word does not scroll a phone page sideways.

## Anatomy

```text
TextFold
```

## API reference

### TextFold

| Prop | Type | Default | Description |
| --- | --- | --- | --- |
| `children` | `string` |  | The text. It folds as one sheet of paper, across all its lines. |
| `slats` | `number` | 4 | How many bands the sheet folds into, from 2 to 12. Default 4. |
| `angle` | `number` | 80 | The turn of each band when folded, in degrees (90 is edge on). Default 80. |
| `perspective` | `number` | 800 | The 3D view distance in px. Smaller is stronger. Default 800. |
| `trigger` | `"mount" \| "scroll" \| "view"` | "scroll" | What unfolds it: `scroll` (default) the scroll place of the text, `view` one unfold the first time it is on screen, `mount` one unfold at once. |
| `range` | `readonly [number, number]` | DEFAULT_RANGE | With `trigger` `scroll`: where the unfold starts and ends, as shares of the view height from its top. Default `[1, 0.6]`: it starts to open when the top of the text is at the bottom edge of the view, and it is flat when the middle of the text is at 60%. When the page cannot scroll that far (the text is near the end of the page), it is flat at the end of the scroll. |
| `container` | `RefObject<HTMLElement \| null>` |  | With `trigger` `scroll`: the scroll box, when the text scrolls inside one. |
| `refold` | `number` | 0 | How far the sheet folds again while the mouse is on it, or while keyboard focus is on it or on an element around it, from 0 (off, default) to 1 (fully). |

## Styling

| Part | Slot | States | CSS variables | Tokens |
| --- | --- | --- | --- | --- |
| TextFold | `text-fold` | `data-refold`, `data-stage-focused`, `data-stage-hover` | `--fold-text-angle`, `--fold-text-perspective`, `--fold-text-refold`, `--fold-text-refolded`, `--fold-text-refolded_var`, `--fold-text-slats`, `--motion-ease-panel`, `--motion-panel` | `motion-timing` |

## Usage

Wrap the title of a section. It unfolds as the reader scrolls it into view.

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

```bash
npx shadcn@latest add @gelatin-ui-pro/text-fold @gelatin-ui/badge @gelatin-ui/button
```

```tsx title="chapter-section.tsx"
import { TextFold } from "@/components/pro/text/text-fold";
import { Badge } from "@/components/ui/badge";
import { Button } from "@/components/ui/button";

export function ChapterSection() {
  return (
    <section className="mx-auto flex max-w-3xl flex-col items-start gap-6 px-4 py-40">
      <Badge variant="secondary">Chapter two</Badge>
      <h2 className="text-5xl leading-tight font-bold tracking-tight">
        <TextFold slats={4}>The paper that became a product</TextFold>
      </h2>
      <p className="max-w-lg text-muted-foreground">
        We started with sketches on folded paper. Every screen in the app still begins there.
      </p>
      <Button variant="outline">
        <TextFold trigger="mount" refold={0.4}>
          Read the chapter
        </TextFold>
      </Button>
    </section>
  );
}
```

## 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/text-fold
```

It adds 20 registry items: 19 files, 3584 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

- [Text Perspective](https://gelatinui.com/components/text-perspective.md)
- [Parallax](https://gelatinui.com/components/parallax.md)
- [Tilt](https://gelatinui.com/components/tilt.md)

## Keyboard

| Keys | Action |
| --- | --- |
| Tab | While keyboard focus is on the link or button around the text, it folds again by `refold`, as the mouse would fold it. |

## Motion

| Part | Motion |
| --- | --- |
| Scroll unfold | none · the bands open as the page scrolls, in the same frame as the scroll, with no easing; a scroll back folds them again |
| Unfold on view or mount | draw · 900ms · the folded sheet opens flat once |
| Refold | panel · 260ms · the sheet folds again by `refold` under the mouse or with keyboard focus around it, and opens when they leave |
