Text Cascade

Old letters drop away as new ones roll in, one at a time from the left.

Preview

"use client";

import { useEffect, useState } from "react";
import { TextCascade } from "@/components/motion/text-cascade";

const PHRASES = ["Install skills", "Open settings", "Ship updates"];

export function TextCascadePreview() {
  const [phrase, setPhrase] = useState(0);

  useEffect(() => {
    const id = window.setInterval(() => {
      setPhrase((p) => (p + 1) % PHRASES.length);
    }, 2400);
    return () => window.clearInterval(id);
  }, []);

  return (
    <div className="flex w-full justify-center">
      <p className="text-lg font-medium text-foreground">
        <TextCascade text={PHRASES[phrase] ?? PHRASES[0]} />
      </p>
    </div>
  );
}

Install

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

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

API Reference

text
string

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

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