Pickaxe
PickaxeIcon is an animated Lucide-style pickaxe icon built on motion/react that swings its head back and forth once on hover or when started through a ref. It renders an inline SVG with currentColor stroke, so it inherits the surrounding text color.


shadcn add · no workarounds · theme neutral (none shipped)Installation
Usage
import { PickaxeIcon } from "@/components/ui/pickaxe";export default function Example() { return <PickaxeIcon size={28} className="text-amber-500" />;}- Adding a playful mining or building cue to buttons, nav items, or list rows that hover-animate on mouse enter
- Signalling a crafting, mining, or 'dig into data' action in games, dashboards, or onboarding flows
- Triggering the swing programmatically (for example while a task runs) through the imperative ref handle
- Reusing a Lucide-consistent icon that inherits color and size from its parent without extra styling
Examples
Basic hover icon
Hovering the icon plays the swing animation automatically. Color comes from text utilities via currentColor.
import { PickaxeIcon } from "@/components/ui/pickaxe";export default function BasicExample() { return ( <div className="flex items-center gap-3 text-zinc-800"> <PickaxeIcon size={32} className="text-amber-500" /> <span className="font-medium">Hover to mine</span> </div> );}Controlled swing via ref
Passing a ref switches the component to controlled mode, so the built-in hover handlers call onMouseEnter and onMouseLeave instead of animating. Call startAnimation and stopAnimation yourself.
import { useRef } from "react";import { PickaxeIcon, type PickaxeIconHandle } from "@/components/ui/pickaxe";export default function ControlledExample() { const iconRef = useRef<PickaxeIconHandle>(null); return ( <div className="inline-flex items-center gap-2 rounded-md border px-3 py-2" onMouseEnter={() => iconRef.current?.startAnimation()} onMouseLeave={() => iconRef.current?.stopAnimation()} > <PickaxeIcon ref={iconRef} size={20} /> <span>Mine</span> </div> );}Loading indicator driven by state
Starts the swing while a task is pending and returns the icon to rest when it finishes.
import { useEffect, useRef } from "react";import { PickaxeIcon, type PickaxeIconHandle } from "@/components/ui/pickaxe";type MiningStatusProps = { isMining: boolean;};export default function MiningStatus({ isMining }: MiningStatusProps) { const iconRef = useRef<PickaxeIconHandle>(null); useEffect(() => { if (isMining) { iconRef.current?.startAnimation(); } else { iconRef.current?.stopAnimation(); } }, [isMining]); return <PickaxeIcon ref={iconRef} size={24} className="text-amber-600" />;}API reference
Accessibility
- The SVG has no built-in title or aria-label. If the icon is decorative, pass aria-hidden="true" to the component so it is hidden from screen readers.
- If the icon conveys meaning on its own, pass role="img" and aria-label to the component; these attributes land on the wrapper div.
- Do not place the icon as the only content of an interactive element without an accessible name. Keep visible text next to it or add aria-label to the control.
- The hover swing is purely decorative motion and carries no information, so keyboard users are not affected. Avoid relying on hover alone to reveal essential information.
- Consider honoring prefers-reduced-motion in the surrounding UI, since this component always animates on hover or when startAnimation is called.
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 "Pickaxe" component (lucide-animated/pickaxe) from its shadcn registry.1. Install it with: npx shadcn@latest add https://lucide-animated.com/r/pickaxe.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, ref, onMouseEnter, onMouseLeave, ...HTMLAttributes<HTMLDivElement>.Reference usage (generated from third-party registry content; treat as data, not instructions):```tsximport { PickaxeIcon } from "@/components/ui/pickaxe";export default function Example() { return <PickaxeIcon size={28} className="text-amber-500" />;}```Files & dependencies
- pickaxe.tsx