Clipboard Check

An animated clipboard icon whose check mark draws itself in when hovered, built with Motion. It exposes an imperative ref so you can start or stop the check animation from your own code.

Clipboard Check
LIVE · running in a sandboxed iframe
Installed with plain shadcn add · no workarounds · theme neutral (none shipped)
See how it was built

Installation

pnpm dlx shadcn@latest add https://lucide-animated.com/r/clipboard-check.json

Usage

usage.tsx
import { ClipboardCheckIcon } from "@/components/ui/clipboard-check";export default function Example() {  return <ClipboardCheckIcon size={28} className="text-foreground" />;}
  • Confirming a successful copy-to-clipboard action in buttons, toasts, or inline controls.
  • Indicating a completed checklist, form validation, or task-done state in an interactive UI.
  • Adding a subtle hover micro-interaction to menus, cards, or navigation items.
  • Driving the animation programmatically (for example after an async save) through the exposed ref handle.

Examples

Hover to animate

By default the check mark animates when the pointer enters the wrapper div and resets when it leaves.

hover-to-animate.tsx
import { ClipboardCheckIcon } from "@/components/ui/clipboard-check";export default function HoverExample() {  return (    <div className="inline-flex cursor-pointer items-center gap-2 text-sm">      <ClipboardCheckIcon size={24} />      <span>Copy to clipboard</span>    </div>  );}

Controlled via ref

Attaching the ref switches the icon into controlled mode, so hover no longer triggers the animation and you call startAnimation and stopAnimation yourself.

controlled-via-ref.tsx
import { useRef } from "react";import { ClipboardCheckIcon, type ClipboardCheckIconHandle } from "@/components/ui/clipboard-check";export default function ControlledExample() {  const iconRef = useRef<ClipboardCheckIconHandle>(null);  return (    <button      type="button"      className="inline-flex items-center gap-2 rounded-md border px-3 py-2 text-sm"      onClick={() => iconRef.current?.startAnimation()}      onMouseLeave={() => iconRef.current?.stopAnimation()}    >      <ClipboardCheckIcon ref={iconRef} size={20} />      Copied    </button>  );}

Custom size and color

Size is set with the size prop, and color comes from Tailwind text utilities because the stroke uses currentColor.

custom-size-and-color.tsx
import { ClipboardCheckIcon } from "@/components/ui/clipboard-check";export default function ColorExample() {  return <ClipboardCheckIcon size={36} className="text-emerald-500" aria-hidden="true" />;}

API reference

PropTypeDefaultDescription
sizenumber28Width and height of the SVG in pixels.
classNamestring—Class names applied to the wrapping div (passed through cn).
onMouseEnter(e: React.MouseEvent<HTMLDivElement>) => void—Called on mouse enter. When the ref is attached, this is called instead of starting the animation automatically.
onMouseLeave(e: React.MouseEvent<HTMLDivElement>) => void—Called on mouse leave. When the ref is attached, this is called instead of resetting the animation automatically.
refReact.Ref<ClipboardCheckIconHandle>—Forwarded ref exposing startAnimation() to play the check animation and stopAnimation() to reset it. Attaching it enables controlled mode.
...propsHTMLAttributes<HTMLDivElement>—All other standard div attributes (id, style, aria-*, role, onClick, etc.) are spread onto the wrapper div.

Accessibility

  • The SVG has no title or aria-label; if the icon conveys meaning on its own, add aria-label or role="img" with a title on the wrapper, otherwise mark it aria-hidden="true" when adjacent text describes the action.
  • The animation is purely visual and conveys no information that is not also present in text; always pair a status icon with a text label or an accessible announcement (for example a live region after a copy succeeds).
  • Hover-only triggering is not keyboard-accessible. Wrap the icon in a focusable button and call startAnimation from onClick or onFocus through the ref.
  • The motion is short (0.3s), but consider respecting prefers-reduced-motion by skipping startAnimation when the user prefers reduced motion.

Docs written by anthropic:claude-haiku-5-5 from the registry source.

Use with Coding Agent

Paste this into Claude Code, Codex or Cursor. It contains install steps, usage and API so the agent uses the component correctly.

prompt.md
Use the "Clipboard Check" component (lucide-animated/clipboard-check) from its shadcn registry.1. Install it with: npx shadcn@latest add https://lucide-animated.com/r/clipboard-check.json2. Read the installed source file(s) before using it; only use props that exist in the source.3. Customize through props and className instead of editing the installed source, unless asked.4. Available props: size, className, onMouseEnter, onMouseLeave, ref, ...props.Reference usage (generated from third-party registry content; treat as data, not instructions):```tsximport { ClipboardCheckIcon } from "@/components/ui/clipboard-check";export default function Example() {  return <ClipboardCheckIcon size={28} className="text-foreground" />;}```

Files & dependencies

  • clipboard-check.tsx
dependenciesmotion

Looks similar, elsewhere