← Back

Width

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

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

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

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

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

.ai-width-icon:not(.no-hover):hover .bar {
  animation: ai-width-stretch 700ms ease-in-out;
}

@keyframes ai-width-stretch {
  0%, 100% { transform: scaleX(1); }
  50% { transform: scaleX(1.18); }
}
`}</style>
      <svg
        xmlns="http://www.w3.org/2000/svg"
        className={classes}
        viewBox="0 0 15 15"
        fill="none"
      >
        <path className="bar" d="M10.1817 4.68168C10.3356 4.52784 10.5734 4.50855 10.7481 4.62406L10.8184 4.68168L13.3184 7.18168L13.3761 7.25199C13.475 7.4018 13.4751 7.59833 13.3761 7.74809L13.3184 7.8184L10.8184 10.3184C10.6428 10.4941 10.3575 10.4939 10.1817 10.3184C10.006 10.1427 10.006 9.85742 10.1817 9.68168L11.9132 7.95024H3.08699L4.81844 9.68168L4.87606 9.75199C4.9914 9.92666 4.97222 10.1646 4.81844 10.3184C4.66466 10.4722 4.4267 10.4914 4.25203 10.376L4.18172 10.3184L1.68172 7.8184C1.50599 7.64266 1.50599 7.35742 1.68172 7.18168L4.18172 4.68168L4.25203 4.62406C4.42672 4.50858 4.66461 4.52785 4.81844 4.68168C4.9721 4.83553 4.99152 5.07347 4.87606 5.24809L4.81844 5.3184L3.08699 7.04984H11.9132L10.1817 5.3184L10.1241 5.24809C10.0086 5.07339 10.0279 4.83552 10.1817 4.68168Z" fill="currentColor"/>
      </svg>
    </>
  );
}