Battery Charging
BatteryChargingIcon is an animated battery icon from the lucide-animated registry that pulses its lightning-bolt glyph while charging. It loops on hover by default and can also be controlled imperatively through a ref.


shadcn add · no workarounds · theme neutral (none shipped)Installation
Usage
import { BatteryChargingIcon } from "@/components/ui/battery-charging";export default function Example() { return <BatteryChargingIcon />;}- Showing a charging or power-related status in dashboards, device settings, or battery indicators
- Adding a subtle, hover-triggered motion accent to navigation items, buttons, or feature cards
- Signaling an in-progress charging or energy state where a looping pulse helps the user notice it
- Driving the animation programmatically from parent state (for example, while a real charge is in progress) by attaching a ref
Examples
Hover-triggered icon in a button
The default uncontrolled mode. The bolt pulses while the pointer is over the icon and stops when it leaves.
import { BatteryChargingIcon } from "@/components/ui/battery-charging";export default function ChargeButton() { return ( <button className="inline-flex items-center gap-2 rounded-md border px-3 py-2"> <BatteryChargingIcon size={20} /> Charge </button> );}Imperative start and stop via ref
Attaching the ref switches the component to controlled mode, so hover no longer animates it and the parent calls startAnimation and stopAnimation instead.
import { useRef } from "react";import { BatteryChargingIcon, type BatteryChargingIconHandle } from "@/components/ui/battery-charging";export default function ChargeControls() { const iconRef = useRef<BatteryChargingIconHandle>(null); return ( <div className="flex items-center gap-2"> <button onClick={() => iconRef.current?.startAnimation()}>Start</button> <button onClick={() => iconRef.current?.stopAnimation()}>Stop</button> <BatteryChargingIcon ref={iconRef} /> </div> );}Sized and colored with className
Size is set with the size prop and color comes from Tailwind text utilities, since the stroke uses currentColor.
import { BatteryChargingIcon } from "@/components/ui/battery-charging";export default function ChargingStatus() { return <BatteryChargingIcon size={40} className="text-green-500" />;}API reference
Accessibility
- The icon is decorative and the SVG has no title, desc, or role, so it is hidden from assistive technology by default. If it conveys meaning (for example, charging status), add visible text or an aria-label on the wrapper, such as aria-label="Charging" with role="img".
- Hover is the only trigger in uncontrolled mode, so the animation is not reachable by keyboard or touch users. Do not rely on it to convey information; pair it with text or a status label.
- Users who prefer reduced motion should not see a continuous pulse. Consider gating the ref-driven startAnimation call on a prefers-reduced-motion check.
- Because the stroke uses currentColor, make sure the surrounding text color meets WCAG contrast requirements against its background.
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 "Battery Charging" component (lucide-animated/battery-charging) from its shadcn registry.1. Install it with: npx shadcn@latest add https://lucide-animated.com/r/battery-charging.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 (HTMLAttributes<HTMLDivElement>).Reference usage (generated from third-party registry content; treat as data, not instructions):```tsximport { BatteryChargingIcon } from "@/components/ui/battery-charging";export default function Example() { return <BatteryChargingIcon />;}```Files & dependencies
- battery-charging.tsx