---
title: "Text Rope"
description: "The text hangs on a rope pinned at both ends. Pull a letter and the rope bends, then swings back straight."
url: https://gelatinui.com/components/text-rope
markdown_url: https://gelatinui.com/components/text-rope.md
access: pro
install: "npx shadcn@latest add @gelatin-ui-pro/text-rope"
version: "2026-11-15"
index: https://gelatinui.com/llms.txt
docs_index: https://gelatinui.com/docs/llms.txt
---

# Text Rope

> The text hangs on a rope pinned at both ends. Pull a letter and the rope bends, then swings back straight.

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

## When to use it

Best for: One short display title on a playful page, where a visitor may grab it and play.

- Use it on display text, 32px and up: the pins and the sag scale with the font.
- Use `swing="none"` to keep it still until a hand moves it.
- Leave out `TextRopeLine` for letters that swing on an unseen rope.

## When not to use it

- For words that fall into a pile and can be thrown, use [Text Falling](https://gelatinui.com/components/text-falling.md).

## Notes for agents

- `TextRopeLetters` takes a string. Up to 40 letters each hang on their own; a longer text hangs by words, and each line has its own rope.
- At rest the letters are the page text with no transform: sharp, selectable, and laid out by the browser. While it swings they move only by `translate` and `rotate`.
- Rapier 2D loads when the text comes near the screen (about 1.3 MB gzip, once per page). With no Rapier the plain text stays and `onError` gets the error.
- A finger on a letter pulls the rope and does not scroll the page; a finger between the letters does.
- The rope waits off screen and in a hidden tab, and stops once it is still.

## Anatomy

```text
TextRope
├─ TextRopeLetters (0..n)
├─ TextRopeLine (0..n)
└─ TextRopeControl (0..n)
```

## API reference

### TextRope

| Prop | Type | Default | Description |
| --- | --- | --- | --- |
| `children` | `ReactNode` |  | A string, or the parts `TextRopeLetters`, `TextRopeLine`, and `TextRopeControl`. |
| `onError` | `ReactEventHandler` |  | Called when Rapier does not load (the plain text stays). |
| `swing` | `"none" \| "view"` | "view" | `view` (default): the rope swings once the first time it shows. `none`: it hangs still. |
| `onSettled` | `function` |  | Called when the rope comes to rest and the letters are the page text again. |
| `labels` | `Partial<{ swing: string; }>` |  | The words of the control (`ROPE_TEXT_LABELS`). Keep the object stable. |

### TextRopeLetters

| Prop | Type | Default | Description |
| --- | --- | --- | --- |
| `locale` | `string` |  | The BCP 47 locale for the letter and word split (`Intl.Segmenter`). Default: the `DisplayLocaleProvider` locale, else `"en-US"`. |
| `children` | `string` |  | The text. Up to 40 letters each hang on their own; a longer text hangs by words. |

### TextRopeLine

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

### TextRopeControl

| Prop | Type | Default | Description |
| --- | --- | --- | --- |
| `className` | `string` |  |  |
| `busy` | `boolean` |  | The button waits for the app (busy words): a spinner, `aria-busy`, and no clicks. Focus stays on the button. The style hook stays `data-loading`. |
| `spinnerPlacement` | `"center" \| "start"` |  | `center` (default): the spinner covers the label. `start`: it takes the leading icon slot. The icon sizes always use `center`, because their one icon is the label. |
| `glass` | `"clear" \| "dark" \| "light"` |  |  |
| `rounded` | `"default" \| "full"` |  |  |
| `size` | `"default" \| "icon" \| "icon-lg" \| "icon-sm" \| "icon-xs" \| "lg" \| "sm" \| "xl" \| "xs"` |  |  |
| `variant` | `"dashed" \| "default" \| "destructive" \| "destructive-outline" \| "ghost" \| "link" \| "media" \| "outline" \| "secondary"` |  |  |
| `visible` | `boolean` | false | The control shows at all times. Default: only on keyboard focus. |

Also takes every prop of Base UI `Button`: https://base-ui.com/react/components/button

## Styling

| Part | Slot | States | CSS variables | Tokens |
| --- | --- | --- | --- | --- |
| TextRope | `text-rope` |  |  |  |
| TextRopeLetters | `text-rope-letters` |  |  |  |
| TextRopeLine | `text-rope-line` |  | `--rope-text-rope` |  |
| TextRopeControl | `text-rope-control` |  |  |  |

## Usage

Wrap the title of a playful page. The rope pins to the ends of each line.

```tsx title="maintenance-page.tsx"
import {
  TextRope,
  TextRopeControl,
  TextRopeLetters,
  TextRopeLine,
} from "@/components/pro/text/text-rope";

export function MaintenancePage() {
  return (
    <main className="flex flex-col items-center gap-4 py-24 text-center">
      <p className="text-sm text-muted-foreground">Registry · planned maintenance</p>
      <h1 className="text-6xl font-bold tracking-tight">
        <TextRope swing="view">
          <TextRopeLetters>Hang in there</TextRopeLetters>
          <TextRopeLine />
          <TextRopeControl />
        </TextRope>
      </h1>
      <p className="text-muted-foreground">Installs come back in about ten minutes.</p>
    </main>
  );
}
```

## 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-rope
```

It adds 34 registry items: 31 files, 5700 lines, and the npm packages `@base-ui/react`, `@dimforge/rapier2d-compat`, `@mantine/hooks`, `@xstate/react`, `clsx`, `motion`, `tailwind-merge`, `tailwind-variants`, `xstate`.

## Built on

- [Button](https://gelatinui.com/components/button.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

- [Text Falling](https://gelatinui.com/components/text-falling.md)
- [Text Elastic Letters](https://gelatinui.com/components/text-elastic-letters.md)

## Keyboard

| Keys | Action |
| --- | --- |
| Tab | Moves focus to the control in the swing room above the text. It shows only while it has keyboard focus, unless `visible` is set. |
| Enter, Space | Swings the rope. |
| Left Arrow, Right Arrow | Pushes the rope to the left or to the right. |

## Motion

| Part | Motion |
| --- | --- |
| Swing | instant · Rapier 2D at 120 steps a second, damped to rest in about 2s, then the letters snap to the page text |
| Release | instant · the rope keeps the speed of the hand, capped at 900px/s (15px a frame at 60 Hz) |
