About
An SVG icon whose strokes travel point-by-point into another icon's shape (menu into close, play into pause) instead of cross-fading, for use inside a toggle button.
Built with React and Tailwind. Copy the prompt and paste it into Claude Code, Cursor or Lovable: your agent adds Icon Morph to your project and fits it to your theme.
Code
How Icon Morph is used: the demo's code. The component's own source comes with a free account.
Usage.tsx
"use client";
import * as React from "react";
import IconMorph from "@/components/ui/icon-morph";
// Ported from elastic-ui's IconMorph.stories.ts ("InAButton" story).
export default function IconMorphButtonDemo() {
const [open, setOpen] = React.useState(false);
return (
<button
type="button"
aria-label={open ? "Close menu" : "Open menu"}
aria-expanded={open}
className="flex size-10 cursor-pointer items-center justify-center rounded-xl bg-muted text-foreground focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-ring"
onClick={() => setOpen((v) => !v)}
>
<IconMorph icon={open ? "close" : "menu"} className="size-5" />
</button>
);
}













