# Gravity Text

> Letters come loose, fall, bounce and climb back.

Each letter drops under gravity, bounces on an invisible floor with a little spin and rests at an angle, then they climb back into the word. For 404 pages, empty states and playful headings.

- Family: Originals
- Plan: Creative. Included with Creative.
- Requires: React, Tailwind CSS v4 and the motion package
- Page with a live preview: https://galactrex.com/ui/gravity-text/
- Licence: https://galactrex.com/ui/license/

## Install

```sh
npx @galactrex/ui login   # once, with an API key from https://galactrex.com/account/
npx @galactrex/ui add gravity-text
```

It installs to `components/galactrex/gravity-text.tsx`, with the shared motion helpers beside it. First time in a project: `npx @galactrex/ui init` (setup guide: https://galactrex.com/docs/ui-components-setup/).

## Usage

```tsx
import { GravityText } from "@/components/galactrex/gravity-text";

<GravityText as="h1" text="Page not found" trigger="click" />
```

## Props

| Prop | Type | Default | Description |
| --- | --- | --- | --- |
| `text` | `string` | — | The text. |
| `as` | `ElementType` | `"span"` | Element to render. |
| `trigger` | `"click" \| "hover" \| "manual"` | `"click"` | What lets the letters fall. |
| `fallen` | `boolean` | — | Fall when true, for trigger="manual". |
| `drop` | `number` | `140` | How far below the text the floor is. |
| `bounce` | `number` | `0.42` | Floor bounciness, 0 to 0.8. |
| `rest` | `number` | `1600` | Ms on the floor before climbing back; 0 stays down. |
| `className` | `string` | — | Extra classes for the outer element. |

## Variants

- **404.** The page title falls on arrival with `trigger="manual"`.
- **Hover gag.** Letters tumble when the pointer arrives.

## Accessibility

- Clickable version is a button with Enter and Space.
- The real text is read once; falling letters are aria-hidden.

## Motion

- A tiny physics step per frame writes transforms straight to the letters; stops when everything rests.
- Reduced motion: letters stay put.
