Button
Install
npm install @svg-animated-icons/reactCLI
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| Flag | Description |
|---|---|
--dest <dir> | Destination directory (default: components/animated-icons) |
Or copy the component with the CLI
CLI
npx @svg-animated-icons/cli add button --reactCode
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 ButtonIcon({ disableHover, className }: Props) {
const classes = [
"ai-button-icon",
disableHover ? "no-hover" : "",
className ?? "",
]
.filter(Boolean)
.join(" ");
return (
<>
<style>{`
.ai-button-icon {
width: 1em;
height: 1em;
display: inline-block;
cursor: pointer;
overflow: visible;
}
.ai-button-icon * {
transform-box: fill-box;
}
.ai-button-icon:not(.no-hover):hover .dot {
animation: ai-button-motion-1 700ms ease-in-out;
}
.ai-button-icon:not(.no-hover):hover .dot-1 { animation-delay: 0ms; }
.ai-button-icon:not(.no-hover):hover .dot-2 { animation-delay: 120ms; }
.ai-button-icon:not(.no-hover):hover .dot-3 { animation-delay: 240ms; }
.ai-button-icon.no-hover * {
transform: none;
opacity: 1;
animation: none;
}
@keyframes ai-button-motion-1 {
0%,
100% {
opacity: 1;
}
50% {
opacity: 0.3;
}
}
`}</style>
<svg
xmlns="http://www.w3.org/2000/svg"
className={classes}
viewBox="0 0 15 15"
fill="none"
>
<rect className="pill" x="0.5" y="4.5" width="14" height="6" rx="2" stroke="currentColor" strokeWidth="1"/>
<circle className="dot dot-1" cx="4.5" cy="7.5" r="0.75" fill="currentColor"/>
<circle className="dot dot-2" cx="7.5" cy="7.5" r="0.75" fill="currentColor"/>
<circle className="dot dot-3" cx="10.5" cy="7.5" r="0.75" fill="currentColor"/>
</svg>
</>
);
}