← Back

Hamburger Menu

Install

npm install @svg-animated-icons/react

CLI

Copy an icon component straight into your project — shadcn-style. Replace {icon} with an icon name like arrow-left.

terminal
npx @svg-animated-icons/cli add {icon} --react
FlagDescription
--dest <dir>Destination directory (default: components/animated-icons)

Or copy the component with the CLI

CLI
npx @svg-animated-icons/cli add hamburger-menu --react

Code

React
// Generated by @svg-animated-icons/cli
// You own this file — edit it freely.

import React from "react";

type Props = {
  disableHover?: boolean;
  className?: string;
};

export function HamburgerMenuIcon({ disableHover, className }: Props) {
  const classes = [
    "ai-hamburger-menu-icon",
    disableHover ? "no-hover" : "",
    className ?? "",
  ]
    .filter(Boolean)
    .join(" ");

  return (
    <>
      <style>{`
.ai-hamburger-menu-icon {
  width: 1em;
  height: 1em;
  display: inline-block;
  cursor: pointer;
  overflow: visible;
}

.ai-hamburger-menu-icon * {
  transform-box: fill-box;
}

.ai-hamburger-menu-icon.no-hover * {
  transform: none;
  opacity: 1;
  animation: none;
}

.ai-hamburger-menu-icon .line { transform-origin: center; }

.ai-hamburger-menu-icon:not(.no-hover):hover .line-1 {
  animation: ai-hamburger-menu-top 700ms ease-in-out;
}

.ai-hamburger-menu-icon:not(.no-hover):hover .line-3 {
  animation: ai-hamburger-menu-bottom 700ms ease-in-out;
}

@keyframes ai-hamburger-menu-top {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(1.5px); }
}

@keyframes ai-hamburger-menu-bottom {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-1.5px); }
}
`}</style>
      <svg
        xmlns="http://www.w3.org/2000/svg"
        className={classes}
        viewBox="0 0 15 15"
        fill="none"
      >
        <path className="line line-1" d="M13.6006 3.00977C13.8286 3.05629 14 3.25829 14 3.5C14 3.74171 13.8286 3.94371 13.6006 3.99023L13.5 4H1.5C1.22386 4 1 3.77614 1 3.5C1 3.22386 1.22386 3 1.5 3H13.5L13.6006 3.00977Z" fill="currentColor"/>
        <path className="line line-2" d="M13.6006 7.00977C13.8286 7.05629 14 7.25829 14 7.5C14 7.74171 13.8286 7.94371 13.6006 7.99023L13.5 8H1.5C1.22386 8 1 7.77614 1 7.5C1 7.22386 1.22386 7 1.5 7H13.5L13.6006 7.00977Z" fill="currentColor"/>
        <path className="line line-3" d="M13.6006 11.0098C13.8286 11.0563 14 11.2583 14 11.5C14 11.7417 13.8286 11.9437 13.6006 11.9902L13.5 12H1.5C1.22386 12 1 11.7761 1 11.5C1 11.2239 1.22386 11 1.5 11H13.5L13.6006 11.0098Z" fill="currentColor"/>
      </svg>
    </>
  );
}