Scramble

Text that decodes quietly into place.

Glyphs flicker, then settle into the real phrase. Trigger it with a button or bump play from your own state.

Token ready
1100ms
28ms
tsx
"use client"import { useState } from "react"import { Scramble } from "@/components/motion/scramble"import { Button } from "@/components/ui/button"const TEXTS = [  "Token ready",  "Copy and ship",  "Compose freely",  "Ship quieter UI"]export function Example() {  const [index, setIndex] = useState(0)  const [play, setPlay] = useState(0)  return (    <div className="flex flex-col items-center gap-6">      <Scramble        text={TEXTS[index]}        play={play}        duration={1100}        speed={28}        className="text-2xl font-medium tracking-wide text-foreground sm:text-3xl"      />      <Button        variant="outline"        onClick={() => {          setIndex((current) => (current + 1) % TEXTS.length)          setPlay((current) => current + 1)        }}      >        Scramble      </Button>    </div>  )}

Installation

npx @arctis-sh/@arctis-sh/ui@latest add scramble

Usage

import { useState } from "react"import { Scramble } from "@/components/motion/scramble"import { Button } from "@/components/ui/button"
const [play, setPlay] = useState(0)<>  <Scramble text="Token ready" play={play} />  <Button onClick={() => setPlay((n) => n + 1)}>Scramble</Button></>

API Reference

Scramble

PropTypeDefault
textstring—
playnumber0
durationnumber1100
speednumber28
charactersstringABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789
classNamestring—

Also accepts the other native span attributes. Duration and speed are in milliseconds.