Dia Text Animation

A fixed sentence whose last word cycles in behind a colorful sweep.

Preview

import { ChromaticTextReveal } from "@/components/motion/chromatic-text-reveal";

export function ChromaticTextRevealPreview() {
  return (
    // The sentence never wraps, so it has to be sized against the space it
    // actually gets — the surrounding column, not the viewport.
    <div className="@container flex w-full justify-center">
      <ChromaticTextReveal
        prefix="Motion that feels"
        words={["natural.", "intentional.", "alive."]}
        startOnView={false}
        className="shrink-0 font-medium tracking-[-0.04em] text-foreground [font-size:clamp(1.25rem,7.8cqw,3rem)]"
      />
    </div>
  );
}

Install

Add it with the shadcn CLI, or copy the source manually.

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

API Reference

prefix
string

Sentence fragment that remains fixed while the final word changes.

Default—
words
string[]

Words revealed one after another after the fixed prefix.

Default—
colors?
string[]

Colors used along the moving chromatic edge.

Default[ "#60a5fa", "#22d3ee", "#f472b6", "#fb7185", "#fbbf24", ]
foregroundColor?
string

Final text color after the sweep passes.

Defaultvar(--foreground)
duration?
number

Sweep duration in seconds.

Default1.2
delay?
number

Delay before the first sweep, in seconds.

Default0
pauseDuration?
number

Rest after a word finishes revealing, in seconds.

Default0.8
loop?
boolean

Returns to the first word after the final word.

Defaulttrue
startOnView?
boolean

Starts when the text enters the viewport.

Defaulttrue
once?
boolean

Only starts on the first viewport entry.

Defaulttrue
inViewMargin?
MarginType

IntersectionObserver root margin used by the viewport trigger.

Default—
className?
string

Classes merged onto the root element.

Default—
Also on React Native. Reveals, sweeps, shimmers, cascades and scrambles.

More in Text Animation

Updated