Text Morph

Shared letters glide into place as one string morphs into another.

Preview

"use client";

import { useState } from "react";
import { TextMorph } from "@/components/motion/text-morph";

export function TextMorphUsage() {
  const [saved, setSaved] = useState(false);

  return (
    <button type="button" onClick={() => setSaved((value) => !value)} className="text-sm font-medium">
      <TextMorph>{saved ? "Saved" : "Save changes"}</TextMorph>
    </button>
  );
}

Install

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

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

API Reference

children
string

The text to show. Changing it morphs from the previous string.

Default—
className?
string

Classes merged onto the root element.

Default—

Updated