currency-euro

CurrencyEuroIcon is an animated euro-currency icon for React that renders an SVG inside a div and plays a horizontal mirror-flip (scaleX 1 to -1 to 1) on hover. It can also be controlled imperatively through a ref with startAnimation and stopAnimation.

currency-euro
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/currency-euro

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

Usage

usage.tsx
import { CurrencyEuroIcon } from '@/components/ui/currency-euro';export function Example() {  return <CurrencyEuroIcon />;}
  • Showing a euro or currency-related affordance such as pricing, billing, or exchange features where a subtle hover animation adds delight
  • Decorating buttons, cards, or navigation items that should feel interactive without heavy motion
  • Triggering the flip programmatically (for example when a price changes) by controlling it through a ref
  • Using a lightweight, theme-aware icon that follows the surrounding text color

Examples

Basic hover animation

Default usage. The icon flips when the pointer enters and returns when it leaves.

basic-hover-animation.tsx
import { CurrencyEuroIcon } from '@/components/ui/currency-euro';export function PricingBadge() {  return (    <div className='flex items-center gap-2 text-sm font-medium'>      <CurrencyEuroIcon size={20} className='text-emerald-600' />      <span>Prices in EUR</span>    </div>  );}

Imperative control via ref

Attaching a ref switches the component to controlled mode, so hover no longer animates on its own and you call startAnimation and stopAnimation directly.

imperative-control-via-ref.tsx
import { useRef } from 'react';import { CurrencyEuroIcon } from '@/components/ui/currency-euro';import type { CurrencyEuroIconHandle } from '@/components/ui/currency-euro';export function ConvertButton() {  const iconRef = useRef<CurrencyEuroIconHandle>(null);  return (    <button      type='button'      className='inline-flex items-center gap-2 rounded-md border px-3 py-2'      onMouseEnter={() => iconRef.current?.startAnimation()}      onMouseLeave={() => iconRef.current?.stopAnimation()}    >      <CurrencyEuroIcon ref={iconRef} size={18} />      Convert to EUR    </button>  );}

Button with animated icon

Placing the icon inside a call-to-action button with a larger size and a custom class.

button-with-animated-icon.tsx
import { CurrencyEuroIcon } from '@/components/ui/currency-euro';export function CheckoutButton() {  return (    <button      type='button'      className='inline-flex items-center gap-2 rounded-lg bg-black px-4 py-2 text-white'    >      <CurrencyEuroIcon size={22} className='text-white' />      Pay in euros    </button>  );}

API reference

PropTypeDefaultDescription
sizenumber28Width and height of the SVG in pixels. Applied to both the width and height attributes.
classNamestring—Additional class names applied to the wrapping div. Forwarded through cn().
onMouseEnter(event: React.MouseEvent<HTMLDivElement>) => void—Mouse enter handler. When a ref is attached (controlled mode), this is called instead of the built-in hover animation.
onMouseLeave(event: React.MouseEvent<HTMLDivElement>) => void—Mouse leave handler. When a ref is attached (controlled mode), this is called instead of the built-in reset animation.
refReact.Ref<CurrencyEuroIconHandle>—Forwarded ref exposing startAnimation() to play the flip and stopAnimation() to return the icon to its normal state.
...HTMLAttributes<HTMLDivElement>HTMLAttributes<HTMLDivElement>—All other standard div attributes (id, style, aria-*, data-*, onClick, and so on) are spread onto the wrapping div.

Accessibility

  • The SVG has no title or aria-label. When the icon conveys meaning on its own, wrap it in an element with aria-label, or add a visually hidden text node, for example aria-label='Euro'.
  • When the icon is decorative beside visible text, add aria-hidden='true' to the wrapping div by passing it as a prop so screen readers skip it.
  • The animation is a purely visual flip. Its meaning must not depend on motion, and it does not flash, so it is safe for users sensitive to motion. Consider honoring prefers-reduced-motion in consuming code if you want to disable the flip.
  • The wrapping div is not focusable and has no role. If the icon is used as a control, place it inside a focusable button or link so keyboard users can reach it, and use startAnimation on focus for parity with hover.
  • Inherit color from currentColor so the icon meets the contrast of the 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 "currency-euro" component (heroicons-animated/currency-euro) from its shadcn registry.1. Install it with: npx shadcn@latest add @heroicons-animated/currency-euro2. 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 { CurrencyEuroIcon } from '@/components/ui/currency-euro';export function Example() {  return <CurrencyEuroIcon />;}```

Files & dependencies

  • currency-euro.tsx
dependenciesmotion

Looks similar, elsewhere