Skip to content

Hyper Text

Motion

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.

src/registry/premium/hyper-text.tsx/r/hyper-text.json

Installation

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

MiniDev UI is in the shadcn registry directory, so the short form works with no setup. Older CLI versions can use the full URL: npx shadcn@latest add https://ui.minidev.pro/r/hyper-text.json

Usage

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

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

API reference

HyperText props
PropTypeDefault
textstring"Close the books in 24 hours"
durationMilliseconds for the whole line to settle.number1100
charactersThe pool of glyphs characters cycle through before they lock.string"ABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789...
triggerWhen to run: the first time it is in view, on hover, or both."mount""hover""both""both"
classNamestring-

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.

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.

Frequently asked questions

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.

Dependencies

npm

motion

Built from

No other MiniDev files

Examples

Custom text and speed

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

Digits only, on hover

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

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.

All Animated React components