receipt-refund

An animated receipt-refund icon for React, rendered as an outlined SVG receipt with a zigzag bottom edge and a return arrow. On hover (or when started through a ref) the arrow slides in from the right and fades in.

receipt-refund
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 @heroicons-animated/receipt-refund

Requires @heroicons-animated in the registries of your components.json (shadcn adds official directory namespaces automatically).

Usage

usage.tsx
import { ReceiptRefundIcon } from "@/components/ui/receipt-refund";export function Example() {  return <ReceiptRefundIcon size={28} />;}
  • Showing a refund, return, or money-back action in checkout, order history, or billing screens
  • Adding a subtle hover micro-interaction to a refund or return button or menu item
  • Replacing a static receipt-refund icon in a design system that uses Heroicons-style outline icons
  • Triggering the arrow animation programmatically, for example when a refund action starts, through the component ref

Examples

Hover-animated icon

Uncontrolled usage. The arrow animates when the pointer enters or leaves the icon wrapper.

hover-animated-icon.tsx
import { ReceiptRefundIcon } from "@/components/ui/receipt-refund";export function HoverIcon() {  return <ReceiptRefundIcon size={32} className="text-emerald-600" />;}

Imperative control via ref

Controlled usage. Call startAnimation and stopAnimation from the parent. Once a ref is attached, the component stops handling hover itself and forwards onMouseEnter and onMouseLeave to the props instead.

imperative-control-via-ref.tsx
import { useRef } from "react";import { ReceiptRefundIcon, type ReceiptRefundIconHandle } from "@/components/ui/receipt-refund";export function RefundStatus({ isProcessing }: { isProcessing: boolean }) {  const iconRef = useRef<ReceiptRefundIconHandle>(null);  return (    <button      type="button"      onClick={() => {        if (isProcessing) {          iconRef.current?.startAnimation();        } else {          iconRef.current?.stopAnimation();        }      }}      className="inline-flex items-center gap-2 rounded-md border px-3 py-2"    >      <ReceiptRefundIcon ref={iconRef} size={20} />      Refund    </button>  );}

Button with hover-triggered animation

The parent button drives the icon through the ref on mouse enter and leave, so the animation is tied to the button rather than the icon element.

button-with-hover-triggered-animation.tsx
import { useRef } from "react";import { ReceiptRefundIcon, type ReceiptRefundIconHandle } from "@/components/ui/receipt-refund";export function RefundButton() {  const iconRef = useRef<ReceiptRefundIconHandle>(null);  return (    <button      type="button"      onMouseEnter={() => iconRef.current?.startAnimation()}      onMouseLeave={() => iconRef.current?.stopAnimation()}      className="inline-flex items-center gap-2 rounded-md border px-3 py-2"    >      <ReceiptRefundIcon ref={iconRef} size={20} />      Refund    </button>  );}

API reference

PropTypeDefaultDescription
sizenumber28Width and height of the SVG in pixels. Applied to both the width and height attributes.
classNamestring—Class name applied to the outer div wrapper, not the SVG. Passed through cn().
onMouseEnter(e: React.MouseEvent<HTMLDivElement>) => void—Mouse enter handler on the wrapper div. When no ref is attached, the icon plays its animation and this handler is not called. When a ref is attached (controlled mode), this handler is called instead of the built-in animation.
onMouseLeave(e: React.MouseEvent<HTMLDivElement>) => void—Mouse leave handler on the wrapper div. When no ref is attached, the icon returns to its resting state and this handler is not called. When a ref is attached (controlled mode), this handler is called instead of the built-in reset.
...HTMLAttributes<HTMLDivElement>HTMLAttributes<HTMLDivElement>—All other standard div attributes (id, style, aria-*, role, tabIndex, onClick, etc.) are spread onto the outer wrapper div. The component does not accept a ref to the SVG element directly; the forwarded ref is the ReceiptRefundIconHandle.

Accessibility

  • The SVG has no title, aria-label, or role attribute, so it is treated as decorative. If the icon conveys meaning on its own, add role="img" and aria-label to the wrapper via props, for example <ReceiptRefundIcon role="img" aria-label="Refund" />.
  • If the icon sits inside a labeled button or link that already has visible text, keep it decorative and do not add a label to avoid duplicate announcements.
  • The animation is a short 0.4s position and opacity change and is not looping, so it does not need a reduced-motion override. Consumers that want to respect prefers-reduced-motion should avoid calling startAnimation in that case.
  • The wrapper is a div with no built-in focus or keyboard behavior. If it is interactive, put it inside a native button or link, or add tabIndex, role, and keyboard handlers yourself.
  • The icon uses currentColor, so it inherits the text color and keeps the contrast of its surrounding text.

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 "receipt-refund" component (heroicons-animated/receipt-refund) from its shadcn registry.1. Install it with: npx shadcn@latest add @heroicons-animated/receipt-refund2. 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, ...HTMLAttributes<HTMLDivElement>.Reference usage (generated from third-party registry content; treat as data, not instructions):```tsximport { ReceiptRefundIcon } from "@/components/ui/receipt-refund";export function Example() {  return <ReceiptRefundIcon size={28} />;}```

Files & dependencies

  • receipt-refund.tsx
dependenciesmotion

Looks similar, elsewhere