Hyper Text
Text that scrambles through random characters and settles on the real string, on hover, in view or on mount.
pnpm dlx @glinui/cli@latest add hyper-textHover the headline to scramble it again.
Installation
pnpm dlx @glinui/cli@latest add hyper-textCredits. Adapted from Magic UI (MIT, (c) Magic UI). Design tokens, no motion dependency (rAF scramble), real text kept for screen readers, reduced motion levels, trigger modes and SSR safe first paint. Attribution details.
Prefer the package?
Usage
Improvements: no motion dependency (a single rAF loop), per code point cells with no layout shift, graphemes kept together for emoji and combining marks, view and mount triggers, SSR renders the final text so there is no hydration mismatch, and every frame and timer is cancelled on unmount.
Engines: this component drives its main animation through the pluggable motion engine. Pass `engine` (css, motion or gsap), wrap a subtree in `MotionEngineProvider`, or set `data-glin-engine` on `<html>`. The css engine is built in and dependency free; motion and gsap are opt-in via `@glinui/motion/register/*`. `motion="none"` renders the final state and `subtle` is opacity only.
On view with custom characters
Runs once when scrolled into view, scrambling through binary digits.
Decrypting signal
import { HyperText } from "@glinui/ui"
export function Demo() { return ( <HyperText trigger="view" characterSet="01" duration={1200} as="h3"> Decrypting signal </HyperText> )}Proportional glyphs
Turn off tabular cells to use the natural font width.
import { HyperText } from "@glinui/ui"
export function Demo() { return <HyperText tabular={false} className="font-sans text-2xl">Mixed width</HyperText>}Engine comparison
The same component on the css, motion and gsap engines. Replay restarts all three.
CSS
Motion
GSAP
// Same component, three engines. motion and gsap are opt-in:// import "@glinui/motion/register/motion"// import "@glinui/motion/register/gsap"<HyperText engine="css" trigger="mount">Scramble</HyperText>
<HyperText engine="motion" trigger="mount">Scramble</HyperText>
<HyperText engine="gsap" trigger="mount">Scramble</HyperText>Accessibility
- The real string is always present in a screen reader only span; the scrambling glyph layer is aria-hidden.
- Assistive tech never reads random characters.
- With focusable, keyboard focus triggers the same effect as hover and shows a visible focus ring.
Keyboard Interactions
| Key | Action |
|---|---|
| Tab | Focus the text (only when focusable is set) to run the scramble. |
ARIA Attributes
- `aria-hidden` on the glyph layer
- real text in an `sr-only` span
Reduced Motion
With prefers-reduced-motion, or Glin motion level none or subtle, no scramble runs and the final text is shown immediately.
Affected properties
scrambleglyph swapsAPI Reference
| Prop | Type | Required | Default | Description |
|---|---|---|---|---|
children | string | Yes | - | The text to reveal. Required. |
as | HyperTextTag | No | div | Element to render. |
trigger | HyperTextTrigger | No | hover | Run on pointer or focus, once when scrolled into view, or once on mount. |
duration | number | No | 800 | Scramble length in milliseconds. |
delay | number | No | 0 | Delay before a view or mount run, in milliseconds. |
characterSet | string | readonly string[] | No | A to Z | Characters used while scrambling. |
tabular | boolean | No | true | Render each glyph in a one character wide cell so the line width never changes. |
focusable | boolean | No | false | Make the element tabbable so keyboard users can trigger the hover effect. |
engine | EngineName | No | - | Engine override: `css` (default), `motion`, `gsap` or a registered custom engine. |
motion | MotionLevel | No | - | Motion override. `none` renders the static final state, `subtle` is opacity only. |
Source
Import directly from the package or browse the source on GitHub. Click any file to view it.
Import
import { HyperText } from "@glinui/ui"Dependencies
@glinui/ui@glinui/motionGenerated API Snapshot
Beta
Generated API Snapshot
BetaAuto-extracted from TypeScript source in packages/ui/src/components/hyper-text.tsx. This section is in beta and may lag behind hand-curated docs. Regenerate with pnpm --filter @glinui/docs api:generate.
Generated: 2026-10-08T01:41:21.546Z · Full index: /docs/api-metadata
Primary Props Type
HyperTextProps
HyperTextProps
| Prop | Type | Required | Default | Description |
|---|---|---|---|---|
as | HyperTextTag | No | "div" | Element to render. |
characterSet | string | readonly string[] | No | DEFAULT_CHARACTER_SET | Characters used while scrambling. Defaults to A to Z. |
children | string | Yes | - | The text to reveal. |
delay | number | No | 0 | Delay before an automatic run (view or mount) in milliseconds. |
duration | number | No | 800 | Scramble length in milliseconds. |
engine | EngineName | No | - | Engine override: `css` (default), `motion`, `gsap` or a registered custom engine. |
focusable | boolean | No | false | Make the element tabbable so keyboard users can trigger the hover effect. |
motion | MotionLevel | No | - | Motion override. `none` renders the static final state, `subtle` is opacity only. |
tabular | boolean | No | true | Render every glyph in a one character wide cell so the line never changes width. |
trigger | HyperTextTrigger | No | "hover" | When the scramble runs: pointer or keyboard focus, once in view, or once on mount. |