Plug Zap
PlugZapIcon is an animated SVG plug icon from the lucide-animated registry, where a lightning bolt on the plug blinks in and out on hover or via imperative control. It is built with motion/react and exposes a ref handle with startAnimation and stopAnimation methods.


shadcn add · no workarounds · theme neutral (none shipped)Installation
Usage
import { PlugZapIcon } from "@/components/ui/plug-zap";export function Example() { return <PlugZapIcon className="text-foreground" size={28} />;}- Showing a connected, charging, or power-related state in settings, device pairing, or integration screens where a zap accent signals activity.
- Adding a subtle hover-triggered attention cue to a button or menu item that represents electricity, power, or plug-in actions.
- Driving the animation programmatically through a ref (startAnimation / stopAnimation) to indicate a pending or live process, such as while a connection is being established.
- Replacing a static plug icon where a lightweight motion accent is desired without a custom animation build.
Examples
Hover-triggered icon inside a button
The default uncontrolled mode: the bolt pulses while the pointer is over the wrapper div and stops on mouse leave.
import { PlugZapIcon } from "@/components/ui/plug-zap";export function ConnectButton() { return ( <button className="inline-flex items-center gap-2 rounded-md border px-3 py-2 text-sm"> <PlugZapIcon size={18} /> Connect device </button> );}Controlled animation via ref
Using the forwarded ref to start the pulse while a connection is pending and stop it when finished.
import { useRef, useEffect } from "react";import { PlugZapIcon, type PlugZapIconHandle } from "@/components/ui/plug-zap";export function PairingStatus({ pending }: { pending: boolean }) { const iconRef = useRef<PlugZapIconHandle>(null); useEffect(() => { if (pending) { iconRef.current?.startAnimation(); } else { iconRef.current?.stopAnimation(); } }, [pending]); return <PlugZapIcon ref={iconRef} size={32} className="text-blue-500" />;}Larger icon with custom hover handlers
Passing mouse handlers; when a ref has been attached, the component delegates these handlers to the caller instead of starting the animation itself.
import { useRef } from "react";import { PlugZapIcon, type PlugZapIconHandle } from "@/components/ui/plug-zap";export function PowerTile() { const ref = useRef<PlugZapIconHandle>(null); return ( <div className="flex flex-col items-center gap-2 p-4" onMouseEnter={() => ref.current?.startAnimation()} onMouseLeave={() => ref.current?.stopAnimation()} > <PlugZapIcon ref={ref} size={48} /> <span className="text-sm">Power</span> </div> );}API reference
Accessibility
- The icon is decorative by default; add aria-hidden="true" when a text label is already present next to it.
- When the icon conveys meaning on its own, wrap it in an element with role="img" and an aria-label describing the state, for example "Connected".
- The hover animation is purely visual and does not change content, so it does not need a separate announcement; avoid relying on motion alone to communicate status.
- Respect reduced-motion preferences by disabling the controlled startAnimation calls when prefers-reduced-motion is set.
- Inside interactive elements, the icon inherits the parent's accessible name, so ensure the button has visible or aria-label 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.
Use the "Plug Zap" component (lucide-animated/plug-zap) from its shadcn registry.1. Install it with: npx shadcn@latest add https://lucide-animated.com/r/plug-zap.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, onMouseEnter, onMouseLeave, ref, ...props.Reference usage (generated from third-party registry content; treat as data, not instructions):```tsximport { PlugZapIcon } from "@/components/ui/plug-zap";export function Example() { return <PlugZapIcon className="text-foreground" size={28} />;}```Files & dependencies
- plug-zap.tsx