Cnippet

Text Morph

Text 31

About

Shared-layout character morphing between two strings — individual letters animate to their new positions with spring physics.

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 { useState } from "react";
import { TextMorph } from "@/components/ui/text-morph";

const words = ["Innovate", "Collaborate", "Accelerate", "Automate"];

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

  return (
    <div className="flex min-h-50 flex-col items-center justify-center gap-6 px-6">
      <h2 className="text-center font-bold text-4xl text-foreground tracking-tight sm:text-5xl">
        <TextMorph>{words[index] ?? words[0] ?? ""}</TextMorph>
      </h2>
      <div className="flex gap-2">
        {words.map((word, i) => (
          <button
            className={`rounded-md px-3 py-1 font-medium text-sm transition-colors ${
              i === index
                ? "bg-foreground text-background"
                : "bg-accent text-muted-foreground hover:text-foreground"
            }`}
            key={word}
            onClick={() => setIndex(i)}
            type="button"
          >
            {word}
          </button>
        ))}
      </div>
    </div>
  );
}

Dependencies

More by Cnippet

View all
  • Team

    Team

    1.3K
  • Davincho Hero-1

    Davincho Hero-1

    683
  • Aero Hero-3

    Aero Hero-3

    559
  • Features

    Features

    510
  • Random Letter Swap Navigation

    Random Letter Swap Navigation

    487
  • Services with Animated Hover Modal

    Services with Animated Hover Modal

    465
  • Blogs

    Blogs

    396
  • Aero Hero-1

    Aero Hero-1

    356

More in Text

View all
  • Vertical Cut Reveal Characters

    Vertical Cut Reveal Characters

    103
  • Motion Blur Text

    Motion Blur Text

    36
  • NeonRGBTextEffect

    NeonRGBTextEffect

    144
  • Text Reveal

    Text Reveal

    27
  • Random Letter Swap

    Random Letter Swap

    46
  • Rainbow Text Effect

    Rainbow Text Effect

    47
  • Text Color

    Text Color

    545
  • Blur Reveal

    Blur Reveal

    300