joseestevez520

Icon Morph

Buttons

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>
  );
}

More by joseestevez520

View all
  • Progress Button

    Progress Button

    13
  • Chart

    Chart

    5
  • Stat

    Stat

  • Marquee

    Marquee

  • Day Strip

    Day Strip

  • Prose

    Prose

  • File Drop Zone

    File Drop Zone

More in Buttons

View all
  • Button

    Button

    20
  • Button

    Button

    3
  • Button Group

    Button Group

    18
  • Button

    Button

    149
  • Icon Label Subtext Button

    Icon Label Subtext Button

    69
  • Button

    Button

    9
  • Button

    Button

    37
  • Texture Button

    Texture Button

    113