← Back

File

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

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

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

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

.ai-file-icon .file {
  transform-box: view-box;
  transform-origin: 11.293px 5px;
}

.ai-file-icon:not(.no-hover):hover .file {
  animation: ai-file-fold 700ms ease-in-out;
}

@keyframes ai-file-fold {
  0%, 100% { transform: rotate(0); }
  50% { transform: rotate(-6deg); }
}
`}</style>
      <svg
        xmlns="http://www.w3.org/2000/svg"
        className={classes}
        viewBox="0 0 15 15"
        fill="none"
      >
        <path className="file" d="M8.59766 1.00977C8.69389 1.02894 8.78311 1.07608 8.85352 1.14648L12.8535 5.14648C12.9473 5.24025 13 5.36739 13 5.5V12.5C13 13.3284 12.3284 14 11.5 14H3.5C2.67157 14 2 13.3284 2 12.5V2.5C2 1.67157 2.67157 1 3.5 1H8.5L8.59766 1.00977ZM3.5 2C3.22386 2 3 2.22386 3 2.5V12.5C3 12.7761 3.22386 13 3.5 13H11.5C11.7761 13 12 12.7761 12 12.5V6H8.5C8.22386 6 8 5.77614 8 5.5V2H3.5ZM9 5H11.293L9 2.70703V5Z" fill="currentColor"/>
      </svg>
    </>
  );
}