qr-code-01
qr-code-01 is an animated QR code icon from the hugeicons-animated registry, built on motion/react. On hover it plays a one-shot scan: a thin horizontal scanner line sweeps down the code while the corner and data cells pulse in sequence.
shadcn add · no workarounds · theme neutral (none shipped)Installation
Requires @hugeicons-animated in the registries of your components.json (shadcn adds official directory namespaces automatically).
Usage
import { QrCode01Icon } from '@/components/ui/qr-code-01';export function Example() { return <QrCode01Icon size={28} className="text-foreground" />;}- Showing a QR code, scan, or pairing action in a button, menu, or card where a subtle one-shot hover animation adds feedback
- Replacing a static QR icon in onboarding, checkout, or device-linking UI with a lightweight animated version
- Signalling that a scan or camera-based feature is active when the parent controls playback via the imperative ref
- Using a monochrome icon that adapts to light and dark themes through currentColor
Examples
Hover to play once
Default behavior: the animation plays once on mouse enter. Mouse leave does nothing because loops is fixed to false internally.
import { QrCode01Icon } from '@/components/ui/qr-code-01';export function HoverIcon() { return ( <div className="inline-flex cursor-pointer text-neutral-800 dark:text-neutral-100"> <QrCode01Icon size={32} /> </div> );}Icon inside a button with a custom mouse handler
onMouseEnter and onMouseLeave are forwarded to the wrapper div and called before the internal animation starts.
import { QrCode01Icon } from '@/components/ui/qr-code-01';export function ScanButton() { return ( <button type="button" className="inline-flex items-center gap-2 rounded-md border px-3 py-2 text-sm" onMouseEnter={() => console.log('scan hover')} > <QrCode01Icon size={20} /> Scan code </button> );}Imperatively controlled playback
Attaching a ref switches the icon to controlled mode: hover no longer auto-plays, and the parent calls startAnimation or stopAnimation.
'use client';import { useRef } from 'react';import { QrCode01Icon, type QrCode01IconHandle } from '@/components/ui/qr-code-01';export function ControlledScan() { const iconRef = useRef<QrCode01IconHandle>(null); return ( <div className="flex items-center gap-3"> <QrCode01Icon ref={iconRef} size={28} /> <button type="button" onClick={() => iconRef.current?.startAnimation()}> Play </button> <button type="button" onClick={() => iconRef.current?.stopAnimation()}> Stop </button> </div> );}API reference
Accessibility
- The icon is decorative by default: the SVG has no title, role, or aria-label. When it conveys meaning, wrap it in an element with an accessible name or pass aria-label and role="img" through the wrapper props.
- The wrapper is a plain div with no keyboard behavior. If the icon triggers an action, place it inside a button or link that provides focus and keyboard activation, and do not rely on hover alone.
- Animation respects prefers-reduced-motion: the internal hook returns early when useReducedMotion() is true, so no motion plays for those users.
- Hover-only animation gives no feedback on touch devices. Ensure the surrounding control conveys its state through text or other cues.
- The icon uses currentColor, so it keeps the contrast of its parent text color; verify contrast against the background in both themes.
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 "qr-code-01" component (hugeicons-animated/qr-code-01) from its shadcn registry.1. Install it with: npx shadcn@latest add @hugeicons-animated/qr-code-012. 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 { QrCode01Icon } from '@/components/ui/qr-code-01';export function Example() { return <QrCode01Icon size={28} className="text-foreground" />;}```Files & dependencies
- icons/qr-code-01.tsx
- lib/use-icon-animation.ts