# Scramble Text

> Old text scrambles into the new.

Every character shuffles through noise and locks onto its new value at its own moment. For status labels, live values and swapped words.

- Family: Typography
- Plan: Creative. Included with Creative.
- Requires: React, Tailwind CSS v4 and the motion package
- Page with a live preview: https://galactrex.com/ui/scramble-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 scramble-text
```

It installs to `components/galactrex/scramble-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 { ScrambleText } from "@/components/galactrex/scramble-text";

<ScrambleText text={status} />
```

## Props

| Prop | Type | Default | Description |
| --- | --- | --- | --- |
| `text` | `string` | — | Change it to scramble into it. |
| `as` | `ElementType` | `"span"` | Element. |
| `duration` | `number` | `650` | Ms for a change. |
| `glyphs` | `string` | — | Noise characters. |
| `hover` | `boolean` | `false` | Also scramble on hover. |
| `className` | `string` | — | Extra classes for the outer element. |

## Variants

- **Status.** Idle → Running → Done.
- **Nav hover.** `hover` on menu items.

## Accessibility

- The new text is announced politely; noise is aria-hidden.

## Motion

- Writes text per frame, no React re-render.
- Reduced motion: swaps at once.
