---
title: "Text Falling"
description: "Words or letters drop into their box with real physics and pile up. People can drag and throw them."
url: https://gelatinui.com/components/text-falling
markdown_url: https://gelatinui.com/components/text-falling.md
access: pro
install: "npx shadcn@latest add @gelatin-ui-pro/text-falling"
version: "2026-11-14"
index: https://gelatinui.com/llms.txt
docs_index: https://gelatinui.com/docs/llms.txt
---

# Text Falling

> Words or letters drop into their box with real physics and pile up. People can drag and throw them.

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

## When to use it

Best for: One short title in a box with a fixed height, on a playful page such as a 404 page or a footer.

- Give the root a height (`h-72`) and a padding: the words fall to the bottom of the box and pile inside its padding.
- Use `trigger` for what drops the text: `view` (default) the first time it is on screen, `mount`, a `click` on the box, or a mouse `hover`.
- Use `by="grapheme"` for one piece per letter. A script that does not split into letters (Arabic) falls by word.
- Use `gravity` (default 1) and `bounce` (0 to 1, default 0.2) for the feel of the fall.
- Use `showControl` to show the drop and put back Button at all times; by default it shows only on keyboard focus.
- Use `active` and `onActiveChange` to drop and put back the text from the page.

## When not to use it

- For a heading made of particles that move away from the pointer, use [Text Particle](https://gelatinui.com/components/text-particle.md).
- For text that people must read after the effect, such as a long paragraph or a button label, use plain text.

## Notes for agents

- `children` must be a string. A new text, `by`, or `locale` mounts new pieces and puts the text back.
- The root is a `span` with `display: block`, so it is valid inside a heading. Its name is the text in one piece, also by letter; an `aria-label` prop wins.
- The pieces are the real text, moved with `translate` and `rotate`: a screen reader reads the text once, in order, and the layout around it never moves.
- Matter.js (about 26 KB gzip) loads on the first drop. When it does not load, the text stays in place and `onError` gets the error; with no `onError` the browser reports it.
- After the drop, a mouse or a finger drags a piece and throws it. A finger on a piece does not scroll the page; a finger on the rest of the box does. `draggable={false}` turns dragging off.
- The physics stop when every piece rests, and wait while the box is off screen or the tab is hidden. A new box size or font size moves the walls and resizes the pieces.
- A trigger only drops. To put the text back, the page uses `active`, or the visitor uses the Button.

## Anatomy

```text
TextFalling
```

## API reference

### TextFalling

| Prop | Type | Default | Description |
| --- | --- | --- | --- |
| `onError` | `ReactEventHandler` |  | Called when Matter.js does not load (the text then stays in place). |
| `draggable` | `boolean` |  | The pieces can be dragged and thrown after the drop (mouse and touch). Default true. |
| `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. Its words (or letters) fall into the box and pile up on its floor. |
| `by` | `"grapheme" \| "word"` | "word" | The size of a falling piece: a `word` (default) or a `grapheme` (a letter). |
| `trigger` | `"click" \| "hover" \| "mount" \| "view"` |  | What drops the text: `mount`, `view` (the first time it is on screen, default), a `click` on the box, or a mouse `hover`. The Button that keyboard users reach always drops and resets. |
| `active` | `boolean` |  | Controlled: `true` drops the text, `false` puts it back. Pass `onActiveChange` with it. |
| `defaultActive` | `boolean` |  | Uncontrolled: `true` drops the text on mount, with no trigger. Default `false`. |
| `onActiveChange` | `function` |  | Called when a trigger or the Button asks to drop (`true`) or to put back (`false`). |
| `gravity` | `number` |  | The pull down, as a share of Matter's default gravity. Default 1. |
| `bounce` | `number` |  | How much a piece bounces, 0 to 1 (Matter `restitution`). Default 0.2. |
| `showControl` | `boolean` |  | The Button shows at all times. Default: only on keyboard focus. |
| `labels` | `Partial<typeof FALLING_TEXT_LABELS>` |  | The words of the Button (`FALLING_TEXT_LABELS`). Keep the object stable. |

## Styling

| Part | Slot | States | CSS variables | Tokens |
| --- | --- | --- | --- | --- |
| TextFalling | `text-falling` |  |  |  |

## Usage

Wrap the title of a playful page. Give the box a height and a padding.

```tsx title="not-found-page.tsx"
import { TextFalling } from "@/components/pro/text/text-falling";
import { Button } from "@/components/ui/button";

export function NotFoundPage() {
  return (
    <main className="mx-auto flex max-w-2xl flex-col gap-4 px-4 py-16">
      <p className="text-sm font-medium text-muted-foreground">Error 404</p>
      <h1>
        <TextFalling
          trigger="view"
          showControl
          className="h-80 rounded-xl border bg-card p-8 text-5xl font-semibold tracking-tight"
        >
          This page fell apart
        </TextFalling>
      </h1>
      <p className="text-muted-foreground">
        The page you asked for is not here. Drag the words around while you are at it.
      </p>
      <div className="flex gap-2">
        <Button render={<a href="/" />} nativeButton={false}>
          Go home
        </Button>
        <Button variant="outline" render={<a href="/docs" />} nativeButton={false}>
          Read the docs
        </Button>
      </div>
    </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-falling
```

It adds 38 registry items: 35 files, 6198 lines, and the npm packages `@base-ui/react`, `@mantine/hooks`, `@xstate/react`, `clsx`, `matter-js`, `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 Particle](https://gelatinui.com/components/text-particle.md)
- [Dice Roll](https://gelatinui.com/components/dice-roll.md)
- [Coin Flip](https://gelatinui.com/components/coin-flip.md)
- [Magnetic](https://gelatinui.com/components/magnetic.md)

## Keyboard

| Keys | Action |
| --- | --- |
| Tab | Moves focus to the Button in the top corner of the box. It shows only while it has keyboard focus, unless `showControl` is set. |
| Enter, Space | Drops the text, or puts it back when it has fallen. |

## Motion

| Part | Motion |
| --- | --- |
| Fall | instant · each piece falls on Matter.js physics at 120 steps a second, with a small kick out from the middle, and rests in a pile |
| Drag | instant · a held piece follows the pointer on a soft physics pull, and keeps the speed of a throw when it is let go |
| Put back | reveal · 400ms · every piece slides and turns back to its place in the line |
