← Back

Copy

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 copy --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 CopyIcon({ disableHover, className }: Props) {
  const classes = [
    "ai-copy-icon",
    disableHover ? "no-hover" : "",
    className ?? "",
  ]
    .filter(Boolean)
    .join(" ");

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

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

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

.ai-copy-icon .front { transform-origin: center; }

.ai-copy-icon:not(.no-hover):hover .front {
  animation: ai-copy-shift 700ms ease-in-out;
}

@keyframes ai-copy-shift {
  0%, 100% { transform: translate(0, 0); }
  50% { transform: translate(-4px, -4px); }
}
`}</style>
      <svg
        xmlns="http://www.w3.org/2000/svg"
        className={classes}
        viewBox="0 0 15 15"
        fill="none"
      >
        <rect className="back" x="1.5" y="1.5" width="8" height="8" rx="0.5" stroke="currentColor" strokeWidth="1"/>
        <rect className="front" x="5.5" y="5.5" width="8" height="8" rx="0.5" stroke="currentColor" strokeWidth="1"/>
      </svg>
    </>
  );
}