← Back

Commit

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

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

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

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

.ai-commit-icon .node {
  transform-origin: center;
}

.ai-commit-icon .line-left,
.ai-commit-icon .line-right {
  stroke-dasharray: 4 6;
}

.ai-commit-icon:not(.no-hover):hover .node {
  animation: ai-commit-slide 700ms ease-in-out;
}

.ai-commit-icon:not(.no-hover):hover .line-left {
  animation: ai-commit-line-left 700ms ease-in-out;
}

.ai-commit-icon:not(.no-hover):hover .line-right {
  animation: ai-commit-line-right 700ms ease-in-out;
}

@keyframes ai-commit-slide {
  0%, 100% { transform: translateX(0); }
  50% { transform: translateX(2px); }
}

@keyframes ai-commit-line-left {
  0%, 100% { stroke-dasharray: 4 6; }
  50% { stroke-dasharray: 6 6; }
}

@keyframes ai-commit-line-right {
  0%, 100% { stroke-dasharray: 4 6; }
  50% { stroke-dasharray: 2 6; }
}
`}</style>
      <svg
        xmlns="http://www.w3.org/2000/svg"
        className={classes}
        viewBox="0 0 15 15"
        fill="none"
      >
        <path className="line-left" d="M1 7.5H7" stroke="currentColor" strokeWidth="1" strokeLinecap="round"/>
        <path className="line-right" d="M14 7.5H8" stroke="currentColor" strokeWidth="1" strokeLinecap="round"/>
        <circle className="node" cx="7.5" cy="7.5" r="2.5" stroke="currentColor" strokeWidth="1"/>
      </svg>
    </>
  );
}