Checkbox
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 checkbox --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 CheckboxIcon({ disableHover, className }: Props) {
const classes = [
"ai-checkbox-icon",
disableHover ? "no-hover" : "",
className ?? "",
]
.filter(Boolean)
.join(" ");
return (
<>
<style>{`
.ai-checkbox-icon {
width: 1em;
height: 1em;
display: inline-block;
cursor: pointer;
overflow: visible;
}
.ai-checkbox-icon * {
transform-box: fill-box;
}
.ai-checkbox-icon.no-hover * {
transform: none;
opacity: 1;
animation: none;
}
.ai-checkbox-icon .check {
stroke-dasharray: 10;
stroke-dashoffset: 10;
}
.ai-checkbox-icon:not(.no-hover):hover .check {
animation: ai-checkbox-draw 700ms ease-out forwards;
}
.ai-checkbox-icon:not(:hover) .check {
stroke-dashoffset: 0;
}
@keyframes ai-checkbox-draw {
from { stroke-dashoffset: 10; }
to { stroke-dashoffset: 0; }
}
`}</style>
<svg
xmlns="http://www.w3.org/2000/svg"
className={classes}
viewBox="0 0 15 15"
fill="none"
>
<rect className="box" x="1.5" y="1.5" width="12" height="12" rx="0.5" stroke="currentColor" strokeWidth="1"/>
<path className="check" d="M4.5 7.5L6.75 9.75L10.5 5.25" stroke="currentColor" strokeWidth="1.25" strokeLinecap="round" strokeLinejoin="round"/>
</svg>
</>
);
}