# Hyper Text

> A React text effect that scrambles characters through random glyphs and settles them left to right on mount or hover, in monospace so the width never jumps.

- Kind: Motion component (Motion)
- Docs: https://ui.minidev.pro/docs/hyper-text
- Source (registry JSON with the full file): https://ui.minidev.pro/r/hyper-text.json
- License: MIT. One file, yours to edit after install.

## When to use

Use it for short headline moments (a tagline, a stat line); keep it under a line or two. For a headline that types word by word use HeroTypedHeadline, for a gradient fill use GradientText.

## Installation

### shadcn CLI (copies the source into your project)

```bash
npx shadcn@latest add @minidev/hyper-text
```

Writes `components/ui/hyper-text.tsx` and installs its npm dependencies. Older CLI versions: `npx shadcn@latest add https://ui.minidev.pro/r/hyper-text.json`.

### npm package

```bash
npm i minidev-ui-kit motion
```

Add the tokens to your global stylesheet once:

```css
@import "tailwindcss";
@import "minidev-ui-kit/styles.css";
@source "../node_modules/minidev-ui-kit";
```

Next.js also needs `transpilePackages: ["minidev-ui-kit"]` in next.config.

## Import

After the shadcn install:

```tsx
import { HyperText } from "@/components/ui/hyper-text"
```

From the npm package:

```tsx
import { HyperText } from "minidev-ui-kit/premium/hyper-text"
```

## Usage

```tsx
import { HyperText } from "@/components/ui/hyper-text"

export function Example() {
  return (
    <HyperText />
  )
}
```

## Props

| Prop | Type | Default | Required | Description |
| --- | --- | --- | --- | --- |
| `text` | `string` | `"Close the books in 24 hours"` | no |  |
| `duration` | `number` | `1100` | no | Milliseconds for the whole line to settle. |
| `characters` | `string` | `"ABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789...` | no | The pool of glyphs characters cycle through before they lock. |
| `trigger` | `"mount" \| "hover" \| "both"` | `"both"` | no | When to run: the first time it is in view, on hover, or both. |
| `className` | `string` | - | no |  |

## Examples

### Custom text and speed

text is what settles; duration is the milliseconds the whole line takes, so a longer value scrambles for longer.

```tsx
<HyperText text="INV-2041 paid in full" duration={1800} />
```

### Digits only, on hover

characters is the pool the glyphs cycle through; trigger hover leaves it still until the pointer arrives.

```tsx
<HyperText text="$128,400.00" characters="0123456789" trigger="hover" className="text-4xl sm:text-5xl" />
```

### Small, in a status pill

Size it down with className and run it once on mount for a status line that decodes as the page loads.

```tsx
<div className="flex items-center gap-2.5 rounded-full border border-border bg-surface px-4 py-2 shadow-xs">
  <span className="size-2 rounded-full bg-success" aria-hidden />
  <HyperText text="ALL LUMEN SYSTEMS OPERATIONAL" trigger="mount" duration={900} className="text-xs sm:text-xs tracking-[0.08em] text-fg-muted" />
</div>
```

## Accessibility

- Screen readers get the text once from an `sr-only` span. The scrambling glyphs are `aria-hidden`.
- Under reduced motion it never scrambles; the final text shows at once.

## FAQ

### Can I use HyperText as the page heading?

Wrap it: `<h1><HyperText text="Close the books in 24 hours" /></h1>`. It renders a `<span>`, and the server HTML already contains the final text, so crawlers see the real words.

### How do I run it only once, or only on hover?

Set `trigger`: `"mount"` runs the first time 60% of it is in view, `"hover"` runs on pointer enter, and `"both"` (the default) does both. Touch never triggers the hover run.

## Rules for generating code

- Use semantic tokens only (bg, surface, sunken, border, fg, fg-muted, fg-subtle, ink, accent, success, warning, danger). Never raw hex or palette steps like blue-500.
- Shadows only from the set: shadow-xs, shadow-sm, shadow-raised, shadow-md, shadow-lg, shadow-overlay.
- Numbers use tabular-nums. Dark mode is the `dark` class on <html>; components never branch on theme.

## Dependencies

- npm: `motion`

## Related

- [Text](https://ui.minidev.pro/docs/text/md): Text paragraph primitive with muted, subtle and mono variants on top of your base type styles. Keeps secondary copy and inline technical text consistent.
- [Hero Typed Headline](https://ui.minidev.pro/docs/hero-typed-headline/md): A centered hero whose headline cycles through rotating words such as dashboards and AI apps with a slide transition. Rotation pauses for reduced motion.
- [Gradient Text](https://ui.minidev.pro/docs/gradient-text/md): Headline text filled with a slowly drifting gradient built from your accent tokens. A real text node for SEO and screen readers, still for reduced motion.
- [Text Scramble](https://ui.minidev.pro/docs/text-scramble/md): A text effect that scrambles random glyphs and resolves to the final string letter by letter when it scrolls into view. Its aria-label keeps the real text.
- [Word Rotate](https://ui.minidev.pro/docs/word-rotate/md): Rotates words inside a sentence: the old word lifts and blurs away as the next rises in. The slot keeps the widest word's width so the line never jumps.
- [Animated Feature Row](https://ui.minidev.pro/docs/animated-feature-row/md): A row of feature cards that slide up with a staggered delay when scrolled into view. Pass title and description pairs; reduced motion keeps them still.

---

All 557 components: https://ui.minidev.pro/llms.txt (full text: https://ui.minidev.pro/llms-full.txt).
