Skip to content
Feedback & Data

BatteryGauge

The battery is a real wet cell on a bench: a glass jar of acid with lead plates, brass posts and a cloth wire to a wall socket. The acid rises and turns green with the charge, gas bubbles off the plates, and it sloshes when you move the pointer or pull the plug.

Download
  • React
  • Tailwind CSS v4
  • motion

Props

NameTypeDefaultWhat it does
valuenumber-Controlled charge, 0 to 100. Leave out and it runs by itself.
defaultValuenumber34Uncontrolled start charge.
chargingboolean-Controlled plug state.
defaultChargingbooleantruePlugged in at start.
ratenumber3Percent per second while plugged in. It drains at a third of this.
lownumber15At or below this it reads Low.
onPlug(charging: boolean) => void-Called when the plug is pulled or pushed in.
classNamestring"w-full max-w-lg"Set the width here. Everything scales with it.