SVG & Shape

Icon Morph

Also called Hamburger to X, Menu Icon Morph, Line-to-Close Icon

An icon such as a hamburger menu turns into another (X) with bars rotating and moving.

Menu toggles

  • hamburger to X
  • hamburger to arrow
  • play to pause

View demo source

Prompt

Replace [where] with the part of your page and paste the prompt into your AI agent. Each prompt includes the name of the motion, so next time you can simply ask for it by name.

Add an "Icon Morph" (also called hamburger to X or a menu icon morph) to [where].
On each press, the top and bottom bars should first slide together to the middle and then rotate into an X while the middle bar fades out, and pressing again reverses it: quick and snappy.
Make it a real toggle button whose accessible label and expanded state change with it, and keep the icon's size fixed so nothing around it shifts.

Replace [where] with the part of your page and paste the prompt into your AI agent. Each prompt includes the name of the motion, so next time you can simply ask for it by name.