Badge
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 badge --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 BadgeIcon({ disableHover, className }: Props) {
const classes = [
"ai-badge-icon",
disableHover ? "no-hover" : "",
className ?? "",
]
.filter(Boolean)
.join(" ");
return (
<>
<style>{`
.ai-badge-icon {
width: 1em;
height: 1em;
display: inline-block;
cursor: pointer;
overflow: visible;
}
.ai-badge-icon * {
transform-box: fill-box;
}
.ai-badge-icon .line {
transform-origin: center;
}
.ai-badge-icon:not(.no-hover):hover .line {
animation: ai-badge-motion-1 700ms ease-in-out;
}
.ai-badge-icon.no-hover * {
transform: none;
opacity: 1;
animation: none;
}
@keyframes ai-badge-motion-1 {
0%,
100% {
transform: translateX(0);
}
33% {
transform: translateX(-1px);
}
66% {
transform: translateX(1px);
}
}
`}</style>
<svg
xmlns="http://www.w3.org/2000/svg"
className={classes}
viewBox="0 0 15 15"
fill="none"
>
<rect className="pill" x="1" y="5" width="13" height="5" rx="2.5" stroke="currentColor" strokeWidth="1"/>
<path className="line" d="M4.5 7.5H10.5" stroke="currentColor" strokeWidth="1" strokeLinecap="round"/>
</svg>
</>
);
}