Text Animation

Five ways to put headlines and labels in motion: a glyph scramble, a Dia-browser-style colored sweep that cycles the last word, a word or letter rise-in, a shimmering gradient for loading copy, and a departure-board letter cascade for text that changes.

Text Scramble

text-scramble.tsx

Change the text prop and the characters churn through random glyphs before settling on the new value within a set duration; screen readers only hear the final text, and reduced motion shows it at once.

Text Animation Text Scramble preview width

Install

$ bunx --bun shadcn add @karaui/text-scramble
@karaui not found? Add it to components.json
{
  "registries": {
    "@karaui": "https://karaui.kamisama-v0.my.id/r/{name}.json"
  }
}

@karaui is in shadcn's public registry directory, so the latest CLI needs no setup. On an older CLI, merge this into the existing file once and every @karaui/… install resolves.

API Reference

text
string

Final text revealed by the scramble animation.

—
duration?
number

Maximum animation duration in milliseconds.

—
glyphs?
string

Characters sampled while unresolved positions are scrambling.

ABCDEFGHJKLMNPQRSTUVWXYZ0123456789#%&@$?/
className?
string
—
style?
CSSProperties
—

Dia Text Animation

chromatic-text-reveal.tsx

Holds the start of a sentence still and swaps the last word in turn, each new word painted in by a band of color that leaves plain text behind. Inspired by the Dia browser, with loop, pause and start-on-view options.

Text Animation Dia Text Animation preview width

Install

$ bunx --bun shadcn add @karaui/chromatic-text-reveal

API Reference

prefix
string

Sentence fragment that remains fixed while the final word changes.

—
words
string[]

Words revealed one after another after the fixed prefix.

—
colors?
string[]

Colors used along the moving chromatic edge.

[ "#60a5fa", "#818cf8", "#c084fc", "#fb7185", "#fbbf24", ]
foregroundColor?
string

Final text color after the sweep passes.

var(--foreground)
duration?
number

Sweep duration in seconds.

1.2
delay?
number

Delay before the first sweep, in seconds.

0
pauseDuration?
number

Rest after a word finishes revealing, in seconds.

0.8
loop?
boolean

Returns to the first word after the final word.

true
startOnView?
boolean

Starts when the text enters the viewport.

true
once?
boolean

Only starts on the first viewport entry.

true
inViewMargin?
MarginType

IntersectionObserver root margin used by the viewport trigger.

—
className?
string
—

Text Reveal

text-reveal.tsx

Splits text into words or characters and lifts each piece into place as its blur clears, on mount or when scrolled into view, with stagger, delay and offset props.

Text Animation Text Reveal preview width

Install

$ bunx --bun shadcn add @karaui/text-reveal

API Reference

text
string | string[]
—
as?
ElementType
span
className?
string
—
split?
"word" | "char"
word
stagger?
number
0.09
delay?
number
0
blur?
number
12
yOffset?
string | number
40%
spring?
{ stiffness?: number; damping?: number; mass?: number | undefined; } | undefined
—
once?
boolean
true
whileInView?
boolean
false

Text Shimmer

text-shimmer.tsx

A band of light passes over the text on a loop, handy for 'Thinking…' or 'Loading' labels; choose the element type and the cycle length.

Text Animation Text Shimmer preview width

Install

$ bunx --bun shadcn add @karaui/text-shimmer

API Reference

as?
ElementType
span
duration?
number
2.5
className?
string
—

Text Cascade

text-cascade.tsx

Give it a new string and the letters flip over one at a time from left to right like a departure board, old characters falling out as new ones drop in.

Text Animation Text Cascade preview width

Install

$ bunx --bun shadcn add @karaui/text-cascade

API Reference

text
string

Current text. Changing it cascades the letters to the new value.

—
className?
string
—

Updated