Battery Full

An animated battery-full icon built on motion/react that fades the three inner charge bars out and back in on hover, or on demand through an imperative ref. It renders an SVG at a configurable size and forwards extra div attributes to its wrapper.

Battery Full
LIVE · running in a sandboxed iframe
Installed with plain shadcn add · no workarounds · theme neutral (none shipped)
See how it was built

Installation

pnpm dlx shadcn@latest add https://lucide-animated.com/r/battery-full.json

Usage

usage.tsx
import { BatteryFullIcon } from "@/components/ui/battery-full";export function Example() {  return <BatteryFullIcon size={28} />;}
  • Showing a fully charged battery or full power state in dashboards, device status panels, or settings screens
  • Adding a playful hover micro-interaction to a button, menu item, or toolbar icon
  • Driving the charge-bar animation programmatically (for example when a charging or sync action completes) via a ref
  • Replacing a static battery icon where a subtle animated affordance improves feedback

Examples

Basic hover icon

Renders the icon at default size; hovering plays the staggered bar fade.

basic-hover-icon.tsx
import { BatteryFullIcon } from "@/components/ui/battery-full";export default function BasicExample() {  return (    <div className="flex items-center gap-2 text-foreground">      <BatteryFullIcon />      <span>Battery full</span>    </div>  );}

Programmatic control via ref

Uses the imperative handle to start and stop the animation from a button click.

programmatic-control-via-ref.tsx
"use client";import { useRef } from "react";import { BatteryFullIcon, type BatteryFullIconHandle } from "@/components/ui/battery-full";export default function ControlledExample() {  const iconRef = useRef<BatteryFullIconHandle>(null);  return (    <div className="flex items-center gap-3">      <BatteryFullIcon ref={iconRef} size={32} />      <button type="button" onClick={() => iconRef.current?.startAnimation()}>        Play      </button>      <button type="button" onClick={() => iconRef.current?.stopAnimation()}>        Reset      </button>    </div>  );}

Icon inside a button with a label

Places the animated icon in a styled button, using the wrapper's className for layout.

icon-inside-a-button-with-a-label.tsx
import { BatteryFullIcon } from "@/components/ui/battery-full";export default function ButtonExample() {  return (    <button      type="button"      aria-label="Battery status: full"      className="inline-flex items-center gap-2 rounded-md border px-3 py-2 text-sm"    >      <BatteryFullIcon size={20} className="text-green-600" />      Full    </button>  );}

API reference

PropTypeDefaultDescription
sizenumber28Width and height of the rendered SVG in pixels.
classNamestring—Class name applied to the outer wrapper div (passed through cn).
onMouseEnter(e: React.MouseEvent<HTMLDivElement>) => void—Mouse enter handler. When the ref handle is in use (controlled mode), it is called instead of playing the built-in hover animation.
onMouseLeave(e: React.MouseEvent<HTMLDivElement>) => void—Mouse leave handler. In controlled mode it is called instead of resetting the animation.
refReact.Ref<BatteryFullIconHandle>—Exposes startAnimation() (fade out then fade in the bars) and stopAnimation() (reset bars to fully visible). Using the ref switches the icon to controlled mode, which disables the automatic hover animation.
...propsHTMLAttributes<HTMLDivElement>—All other standard div attributes are spread onto the outer wrapper div.

Accessibility

  • The SVG has no title or role, so screen readers may ignore or announce it poorly; add aria-label or a visible text label on the parent element or wrap it in an element with role="img" and aria-label such as "Battery full".
  • When the icon is the only content of an interactive control, give the control an accessible name via aria-label.
  • The animation is purely decorative and conveys no information on its own; do not rely on hover motion to communicate state.
  • Consider respecting prefers-reduced-motion by avoiding calling startAnimation automatically when the user has requested reduced motion.
  • Icon color comes from currentColor, so ensure the surrounding text color meets contrast requirements against the 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.

prompt.md
Use the "Battery Full" component (lucide-animated/battery-full) from its shadcn registry.1. Install it with: npx shadcn@latest add https://lucide-animated.com/r/battery-full.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 { BatteryFullIcon } from "@/components/ui/battery-full";export function Example() {  return <BatteryFullIcon size={28} />;}```

Files & dependencies

  • battery-full.tsx
dependenciesmotion

Looks similar, elsewhere