Daniel Petho

Letter 3D Swap

Heroes 18

About

A text component that rotates each letter in 3D on hover to reveal a second face, useful for animated headings and hero titles.

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

Code

How Letter 3D Swap is used: the demo's code. The component's own source comes with a free account.

Usage.tsx

"use client";

import Letter3DSwap from "@/components/ui/letter-3d-swap";
import { useState } from "react";

export default function Preview() {
  const [debug, setDebug] = useState(false);

  return (
    <div className="relative w-dvw h-dvh flex flex-col items-center justify-center p-8 bg-background">
      <div className="flex flex-col items-center max-w-2xl font-cotham">
        <Letter3DSwap
          mainClassName="text-2xl sm:text-5xl md:text-7xl bg-background lowercase"
          frontFaceClassName={`bg-background ${debug ? "border" : ""} text-foreground`}
          secondFaceClassName={`bg-background ${debug ? "border" : ""} text-foreground`}
          rotateDirection="top"
          staggerDuration={0.03}
          staggerFrom="first"
          transition={{
            type: "spring",
            damping: 25,
            stiffness: debug ? 50 : 160,
          }}
        >
          SET YOUR MIND TO IT
        </Letter3DSwap>
      </div>
    </div>
  );
}

Dependencies

More by Daniel Petho

View all
  • Parallax Floating

    Parallax Floating

    2.2K
  • Text Rotate

    Text Rotate

    2.1K
  • Typewriter

    Typewriter

    1.9K
  • Marquee Along SVG Path

    Marquee Along SVG Path

    1.4K
  • Image Trail

    Image Trail

    1.4K
  • Animated Gradient With SVG

    Animated Gradient With SVG

    884
  • Text Cursor Proximity

    Text Cursor Proximity

    781
  • Pixel Trail

    Pixel Trail

    645

More in Heroes

View all
  • SaaS Template

    SaaS Template

    2.4K
  • Responsive Hero Banner

    Responsive Hero Banner

    2K
  • Hero

    Hero

    1.2K
  • Centered Hero with Image Fan

    Centered Hero with Image Fan

    931
  • Editorial Collage Hero

    Editorial Collage Hero

    430
  • Glass Fold

    Glass Fold

    212
  • Minimalist Hero Fashion

    Minimalist Hero Fashion

    285
  • HeroSectionWithGradient

    HeroSectionWithGradient

    336