pastetaste
Charge Bars
Battery and charging widget: tall segments that fill left to right, a large tabular percentage and the time left. A pulse runs while charging, the bars go red when low, and it settles when full.
Paste it into Claude Code: it installs the component, asks for your brand and content, and places it on the page you name.
Live demo. Move the mouse and scroll inside it.
Install
Or by hand, in a Next.js project with shadcn set up. It writes components/pastetaste/charge-bars.tsx.
npx shadcn@latest add https://pastetaste.com/r/charge-bars.jsonDependenciesmotion@^12.23.0widget-frame
Prompt
Install the pastetaste component "Charge Bars" (charge-bars) into this Next.js project and use it.
What it is: Battery and charging widget: tall segments that fill left to right, a large tabular percentage and the time left. A pulse runs while charging, the bars go red when low, and it settles when full.
Before you place it, ask me (one short message, in my language; "skip" = sensible default): which page and section it goes in, my brand colour (hex), the text, labels or images it should show, and whether I want my logo or my own copy in the demo content. Then:
Steps:
1. If the project has no components.json, run: npx shadcn@latest init -y -d. Then run: npx shadcn@latest add https://pastetaste.com/r/charge-bars.json
(it writes components/pastetaste/charge-bars.tsx and its pastetaste dependencies: widget-frame; install any npm packages it reports: motion@^12.23.0).
2. Import it: import { ChargeBars } from "@/components/pastetaste/charge-bars" (check the file for the exact named export).
3. Put it where it fits on the page I name, keep the rest of the page untouched, and pass props for my colours instead of editing the installed file.
4. It does not depend on Tailwind; colours come from CSS variables (--pt-*) or props.
5. It supports prefers-reduced-motion with a still state; do not remove it.
Props (all optional unless the type has no default):
- level: number = 68 — Charge level, 0 to 100. The percentage counts to it and the segments follow one after another.
- charging: boolean = true — Charging state: shows the bolt, runs the pulse along the filled segments and breathes the front one.
- minutes: number = 65 — Minutes until full while charging, minutes of use left otherwise.
- label: string — Device name in the top row. Without it the row shows the state (Charging, Battery, Low, Full).
- segments: number = 12 (1x1), 10 (2x1) — Number of segments, 4 or more.
- lowAt: number = 20 — At or below this level, and not charging, the card turns red.
- size: '1x1' | '2x1' = '1x1' — 2x1 puts the number on the left and tall bars on the right.
- tone / accent: WidgetTone / string = 'dark' / token — Tile surface and the one accent colour (the filled segments on dark tiles; light tiles fill with ink).
Live preview: https://pastetaste.com/c/charge-bars
Then run the dev server, check it in the browser at desktop and mobile width, and tell me the page URL.Props 8
| Prop | Type | Default | Description |
|---|---|---|---|
| level | number | 68 | Charge level, 0 to 100. The percentage counts to it and the segments follow one after another. |
| charging | boolean | true | Charging state: shows the bolt, runs the pulse along the filled segments and breathes the front one. |
| minutes | number | 65 | Minutes until full while charging, minutes of use left otherwise. |
| label | string | - | Device name in the top row. Without it the row shows the state (Charging, Battery, Low, Full). |
| segments | number | 12 (1x1), 10 (2x1) | Number of segments, 4 or more. |
| lowAt | number | 20 | At or below this level, and not charging, the card turns red. |
| size | '1x1' | '2x1' | '1x1' | 2x1 puts the number on the left and tall bars on the right. |
| tone / accent | WidgetTone / string | 'dark' / token | Tile surface and the one accent colour (the filled segments on dark tiles; light tiles fill with ink). |