battery-charging-01
An animated battery icon that plays a charging sequence on hover: five cells fill up, the battery pulses, and the lightning bolt flashes out and back. It is a client component built on motion/react with forwardRef, so parents can also trigger the animation imperatively.
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 { BatteryCharging01Icon } from '@/components/icons/battery-charging-01';export function Example() { return <BatteryCharging01Icon size={32} className='text-emerald-500' />;}- Showing a device or system that is currently charging, such as a phone, EV, or power-bank status indicator.
- Adding a playful hover-triggered micro-interaction to a pricing, settings, or dashboard card.
- Replacing a static battery icon where a charging state needs to feel alive without a loop.
- Triggering the charge animation programmatically on a user action (for example, a 'Charge' button click) through the exposed ref handle.
Examples
Basic hover animation
Renders the icon at 32px in emerald. It plays the charging sequence once each time the pointer enters the icon.
import { BatteryCharging01Icon } from '@/components/icons/battery-charging-01';export function BasicExample() { return <BatteryCharging01Icon size={32} className='text-emerald-500' />;}Imperative trigger via ref
Passing a ref disables automatic hover playback. The parent calls startAnimation() from a button click.
'use client';import { useRef } from 'react';import { BatteryCharging01Icon, type BatteryCharging01IconHandle } from '@/components/icons/battery-charging-01';export function ChargeButton() { const iconRef = useRef<BatteryCharging01IconHandle>(null); return ( <button type='button' onClick={() => iconRef.current?.startAnimation()} className='inline-flex items-center gap-2 rounded-md border px-3 py-2'> <BatteryCharging01Icon ref={iconRef} size={20} /> Charge </button> );}Accessible status indicator
Gives the icon an accessible name by passing role and aria-label through the wrapper div props.
import { BatteryCharging01Icon } from '@/components/icons/battery-charging-01';export function ChargingStatus() { return ( <div className='flex items-center gap-2 text-sm'> <BatteryCharging01Icon size={24} className='text-amber-500' role='img' aria-label='Battery charging' /> <span>Charging, 64%</span> </div> );}Hover callback
Uses onMouseEnter and onMouseLeave, which are forwarded to the consumer before the internal animation logic runs.
import { BatteryCharging01Icon } from '@/components/icons/battery-charging-01';export function TrackedIcon() { return ( <BatteryCharging01Icon size={28} onMouseEnter={() => console.log('charge preview started')} onMouseLeave={() => console.log('charge preview ended')} /> );}API reference
Accessibility
- The outer wrapper is a plain div and the SVG has no role or title by default. Add role='img' and aria-label (or aria-labelledby) when the icon conveys meaning, such as charging status.
- If the icon is purely decorative next to visible text, pass aria-hidden='true' so screen readers skip it.
- The animation respects the prefers-reduced-motion setting via useReducedMotion(); when reduced motion is requested, startAnimation returns early and the icon does not animate.
- The animation is pointer-driven by default and has no keyboard trigger. If the animation conveys information, expose the same state in text or through the ref-driven startAnimation call on focus or activation.
- The motion is a one-shot, roughly 1.2 second sequence and does not loop, so it does not create sustained motion that could be distracting.
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-01" component (hugeicons-animated/battery-charging-01) from its shadcn registry.1. Install it with: npx shadcn@latest add @hugeicons-animated/battery-charging-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 { BatteryCharging01Icon } from '@/components/icons/battery-charging-01';export function Example() { return <BatteryCharging01Icon size={32} className='text-emerald-500' />;}```Files & dependencies
- icons/battery-charging-01.tsx
- lib/use-icon-animation.ts