document-duplicate
An animated document-duplicate icon built on motion/react. Two overlapping outlined document sheets are drawn as SVG strokes, and the back sheet slides into place and fades in on hover or when triggered through its imperative ref.
shadcn add · no workarounds · theme neutral (none shipped)Installation
Requires @heroicons-animated in the registries of your components.json (shadcn adds official directory namespaces automatically).
Usage
import { DocumentDuplicateIcon } from "@/components/ui/document-duplicate";<DocumentDuplicateIcon size={28} />- Use on copy, duplicate, or clone buttons where a 'make a copy of this document' meaning should be clear at a glance.
- Use in toolbars, file managers, or document editors to signal duplication of a file or item.
- Use as a subtle hover affordance on list rows or cards that can be duplicated, controlled from the parent through the ref handle.
- Avoid it where a static icon is required or where motion should be suppressed, since the animation always runs when triggered.
Examples
Basic hover icon
Renders the icon with the default size of 28. It animates on mouse enter and returns on mouse leave.
import { DocumentDuplicateIcon } from "@/components/ui/document-duplicate";export default function Example() { return <DocumentDuplicateIcon />;}Custom size and color
Sets the pixel size with the size prop and the color through className, which is applied to the wrapping div and inherited via currentColor.
import { DocumentDuplicateIcon } from "@/components/ui/document-duplicate";export default function Example() { return <DocumentDuplicateIcon size={40} className="text-blue-500" />;}Triggered from a button via ref
Uses the exported handle to start the animation when the surrounding button is hovered and stop it on leave. Because a ref is attached, the icon's own hover handlers only forward to the props instead of animating.
"use client";import { useRef } from "react";import { DocumentDuplicateIcon } from "@/components/ui/document-duplicate";import type { DocumentDuplicateIconHandle } from "@/components/ui/document-duplicate";export function CopyButton() { const iconRef = useRef<DocumentDuplicateIconHandle>(null); return ( <button type="button" onMouseEnter={() => iconRef.current?.startAnimation()} onMouseLeave={() => iconRef.current?.stopAnimation()} className="inline-flex items-center gap-2" > <DocumentDuplicateIcon ref={iconRef} size={16} /> Duplicate </button> );}API reference
Accessibility
- The SVG has no title, desc, or role attribute, so it is decorative by default. When the icon conveys meaning alone, add role="img" and aria-label to the wrapping div through props, for example aria-label="Duplicate document".
- If the icon sits inside a button or link that already has visible text, set aria-hidden="true" on the icon wrapper to avoid redundant announcements.
- The animation is purely visual and conveys no information that is unavailable otherwise. Respect prefers-reduced-motion in the surrounding app if the trigger is automatic, since the component does not check that media query itself.
- The wrapping div is not focusable by default. If the icon acts as a control, place it inside a focusable button and drive startAnimation and stopAnimation from focus events as well as hover.
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.
Use the "document-duplicate" component (heroicons-animated/document-duplicate) from its shadcn registry.1. Install it with: npx shadcn@latest add @heroicons-animated/document-duplicate2. 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, ...HTMLAttributes<HTMLDivElement>.Reference usage (generated from third-party registry content; treat as data, not instructions):```tsximport { DocumentDuplicateIcon } from "@/components/ui/document-duplicate";<DocumentDuplicateIcon size={28} />```Files & dependencies
- document-duplicate.tsx