Home battery hero
Shown as Ampwell, a made-up product
Hero for a home-battery controller. A pixel field is one real November day of a home's power, scrubbed by a playhead that drives every readout.
Installation
pnpm dlx shadcn@latest add "https://propui.dev/r/ampwell-hero.json?token=…"Adds the piece to components/propui/01-ampwell-hero/ and installs motion. Needs a free account: sign in and the command includes your token. Fonts load from Prop UI; download the zip to self-host them.
When to use
Reach for it when
- A landing page hero for an energy or home-device product, where one real day of data is the picture.
- Any product whose value shows over time: a scrub-able day that drives a row of readouts.
- A page that wants a ruled, numbered grid frame and pixel-type accents instead of a photo.
Something else fits when
- An app screen people work in every day: a dashboard such as SaaS revenue and usage fits better.
- A hero that should feel like a place, with sky and landscape: Carbon removal hero or Grain storage hero.
- Data with no time axis: a static figure row or a plain chart is simpler.
Usage
Fills a full window: give it a container with a definite height.
import Piece from "@/components/propui/01-ampwell-hero/Section";
export default function Page() {
return (
<main className="h-dvh w-full overflow-hidden">
<Piece />
</main>
);
}Change the model at the top of data.ts (capacity, panel peak, tariff bands and prices, the demand curve) and DAY is rebuilt from it. The pixel field, the readouts and the four figures at the foot are all computed from DAY; the headline and copy live in Section.tsx.
Your data
Replace these and everything on screen follows.
DAY{ h; gen; demand; battery; grid; soc; band }[] (96 steps)- The pixel field, battery lane, tariff strip, sun position and every readout.
CAPACITY, MIN_SOC, MAX_RATEnumber- How the battery charges and discharges through the day.
SUNRISE, SUNSET, PEAK_GENnumber- The solar curve, the sun's arc and the sunrise and sunset labels.
band(), PRICE, EXPORT_P(h) => "cheap" | "day" | "peak"; Record<Band, number>; number- The tariff band at each step, its price in the readouts and the savings sum.
SOLAR_KWH, PEAK_IMPORT, SAVED_TODAYnumber- The figures in row 05, computed from DAY.
Interactions
- Watch the day play from 06:00 to 17:30 once the chart is half in view.
- Drag, hover or press across the chart to move the playhead; the Time, Panels, Battery, Home and Grid readouts follow.
- Moving the playhead stops the intro where it is and hands the day to you.
- Nav links and buttons are placeholders that do nothing when clicked.
Keyboard
- Tab
- Move through the nav links, buttons and the chart.
- →or←
- On the chart, move the playhead 15 minutes.
- Page UporPage Down
- On the chart, move the playhead an hour.
- HomeorEnd
- On the chart, jump to 00:00 or 23:45.
Behaviour
Read from the code: roles, motion, breakpoints and what runs.
Accessibility
- The chart is a focusable role slider labelled Time of day, with aria-valuetext giving the time, panel output, battery level and home use.
- The readout row is a polite live region, so moving the playhead is announced.
- The day section has a visually hidden heading; nav sits in a labelled nav element.
- Pixels, meters, the sun, axis, legend and tariff labels are hidden from screen readers; the same figures are in the readouts as text.
- Focus shows a 2px blue outline.
Motion
- The one moment: the day plays from 06:00 to 17:30 over 3.2s, once, when the chart is half in view.
- The playhead, its band and the sun ride one spring; the sun climbs its arc and its glow follows panel output.
- Readout numbers glide on a spring that retargets mid-flight rather than restarting.
- Buttons press down 1px, the sun mark turns on hover and the ghost button's arrow nudges.
- The piece sets MotionConfig reducedMotion="user"; with reduced motion the intro jumps straight to 17:30 and the numbers jump to their value.
Responsive
- Fills its container and scrolls inside it; the numbered gutter is 96px each side.
- At 1100px and below the gutter is 48px, the headline and copy stack, readouts go three per row and the nav links hide.
- At 640px and below the gutter and row numbers go, readouts go two per row with Time across the top, pixels grow, every other hour label hides, the four figures go two per row and Sign in hides.
Performance
- No animation loop runs at rest: the intro is one tween, and the playhead moves on pointer and key input.
- The pixel field is 1,728 plain elements drawn once and memoised; the playhead slides over it with transforms.
- No canvas, no images: five local font files and inline SVG.
Notes for AI
Give your coding assistant the Markdown, not a screenshot.
- Keep the model in data.ts; every figure on the page is derived from DAY, so never type a number into the readouts.
- STEPS is 96 and the CSS grids use repeat(96, ...); change both together.
- Every class is prefixed aw- and scoped under .aw, because section CSS loads globally.
- The piece fills its parent's height and scrolls inside it (height: 100%); give the parent a height.
- Keep the Field memoised; it should not re-render when the playhead moves.
/p/ampwell-hero/markdownThe whole library for assistants: llms.txt, or the MCP server in AI tools and MCP.