← Back

Slash

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

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

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

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

.ai-slash-icon .slash {
  transform-box: view-box;
  transform-origin: 7.5px 7.5px;
}

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

@keyframes ai-slash-cut {
  0%, 100% { transform: translate(0, 0); }
  50% { transform: translate(0.8px, -0.8px); }
}
`}</style>
      <svg
        xmlns="http://www.w3.org/2000/svg"
        className={classes}
        viewBox="0 0 15 15"
        fill="none"
      >
        <path className="slash" d="M5.46033 14H4.10779L9.46521 1H10.8177L5.46033 14Z" fill="currentColor"/>
      </svg>
    </>
  );
}