erictsai83

Text Morph

Text

About

A Motion-powered text primitive that morphs matching characters between string updates.

Built with React and Tailwind. Copy the prompt and paste it into Claude Code, Cursor or Lovable: your agent adds Text Morph to your project and fits it to your theme.

Code

How Text Morph is used: the demo's code. The component's own source comes with a free account.

Usage.tsx

"use client";

import { useEffect, useState } from "react";

import { cn } from "@/lib/utils";
import { TextMorph } from "@/components/ui/ericts-text-morph";

const textMorphWords = ["Typescript", "Next.js", "React", "Convex", "Vercel"];

export default function Preview() {
  const [index, setIndex] = useState(0);
  const activeWord = textMorphWords[index];

  useEffect(() => {
    const timer = window.setInterval(() => {
      setIndex((value) => (value + 1) % textMorphWords.length);
    }, 2500);

    return () => window.clearInterval(timer);
  }, []);

  return (
    <div className="flex flex-col items-center justify-center gap-4 text-center">
      <div className="rounded-lg border bg-background px-5 py-4 shadow-sm">
        <p className="text-sm text-muted-foreground">Ship with motion</p>
        <p className="mt-1 font-mono text-4xl font-semibold tracking-normal">
          <TextMorph>{activeWord}</TextMorph>
        </p>
      </div>
      <div className="flex gap-1" aria-hidden="true">
        {textMorphWords.map((word, wordIndex) => (
          <span
            key={word}
            className={cn(
              "size-1.5 rounded-full transition-colors",
              wordIndex === index ? "bg-foreground" : "bg-muted-foreground/25",
            )}
          />
        ))}
      </div>
    </div>
  );
}

Dependencies

More by erictsai83

View all
  • Adaptive Drawer

    Adaptive Drawer

  • Status Button

    Status Button

  • Floating Shortcut Button

    Floating Shortcut Button

  • Filter Tags

    Filter Tags

  • Feedback Popover

    Feedback Popover

  • Expandable Toolbar

    Expandable Toolbar

  • Expandable Toggle Button

    Expandable Toggle Button

  • Arc Menu

    Arc Menu

More in Text

View all
  • Vertical Cut Reveal Characters

    Vertical Cut Reveal Characters

    135
  • Astryx Chat Tokenized Text

    Astryx Chat Tokenized Text

    14
  • Scroll Fill Headline

    Scroll Fill Headline

    66
  • Blur Reveal

    Blur Reveal

    398
  • Apple Hello Effect

    Apple Hello Effect

    691
  • Rainbow Text Effect

    Rainbow Text Effect

    61
  • Italic Sweep Scroll Text

    Italic Sweep Scroll Text

    73
  • Shimmering Text

    Shimmering Text

    8