Hyper Text
MotionA 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.
Installation
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
import { HyperText } from "@/components/ui/hyper-text"
export function Example() {
return (
<HyperText />
)
}
API reference
| Prop | Type | Default |
|---|---|---|
| text | string | "Close the books in 24 hours" |
| durationMilliseconds for the whole line to settle. | number | 1100 |
| 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" |
| className | string | - |
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-onlyspan. The scrambling glyphs arearia-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
Built from
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.