# Energy Flow

> A home energy card with solar, battery, grid and house as four nodes and dots that flow along the links at a speed set by the power in kW. Hovering or tapping a node dims every link it isn't part of and shows where its power comes from or goes; below, today's solar and home use curves scrub by the hour and the day's totals count up live.

## Spec sheet

| | |
| --- | --- |
| Access | Free: no account, free for commercial use |
| Shelf | Blocks › Cards |
| Live preview | https://uibrik.com/components/energy-flow |
| Writes | 1 file into `components/uibrik/energy-flow/` |
| Packages | `@tabler/icons-react`, `motion` (the CLI installs them) |
| Needs | React 19, Tailwind CSS v4, a project set up with `npx shadcn@latest init` |
| Theme | Reads the shadcn tokens and follows class-based dark mode ([theming](https://uibrik.com/docs/theming.md)) |
| Updated | Nov 26, 2026 |

## Add it

```bash
npx shadcn@latest add https://uibrik.com/r/energy-flow.json
```

With the `@uibrik` namespace in `components.json` ([setup](https://uibrik.com/docs/installation.md)): `npx shadcn@latest add @uibrik/energy-flow`.

Can't run commands? https://uibrik.com/components/energy-flow/prompt.txt has every file verbatim, with the setup steps, ready for an assistant to write.

## Render it

Renders as is; every value shown is the default, so delete any line you don't need.

```tsx
import { EnergyFlow } from "@/components/uibrik/energy-flow/energy-flow";

<EnergyFlow
  title="Energy"
  color="#e8a317"
  live
  interval={1600}
  capacity={13.5}
  maxBatteryPower={3.8}
  showCurve
  now={14.4}
  width={420}
  defaultValue={{ solar: 4.6, home: 2.1, battery: 64 }}
  defaultSelected={null}
  // value={{ solar: 0, home: 0, battery: 0 }}
  // history={{ solar: [0], home: [0] }}
  // selected="solar"
  // onSelectedChange="solar"
/>
```

## Tune it

The same props as the Customize panel on https://uibrik.com/components/energy-flow.

| Prop | Type | Default | What it does |
| --- | --- | --- | --- |
| `title` | `string` | `"Energy"` | Heading above the diagram. |
| `color` | `string` | `"#e8a317"` | Colour of solar and battery flows. Grid flows stay neutral. |
| `live` | `boolean` | `true` | Run the built-in simulation when no value is passed. |
| `interval` | `number` | `1600` | Time between simulated readings. |
| `capacity` | `number` | `13.5` | Battery size. |
| `maxBatteryPower` | `number` | `3.8` | Fastest the battery charges or discharges. |
| `showCurve` | `boolean` | `true` | Show today's solar and home use under the diagram. |
| `now` | `number` | `14.4` | Hour of day the curve stops at. |
| `width` | `number` | `420` | Width of the card; never wider than its container. |

## Wire it

The props the Customize panel doesn't show: ranges, data, content and callbacks.

| Prop | Type | Default | What it does |
| --- | --- | --- | --- |
| `value` | `{ solar: number; home: number; battery: number }` |  | Live readings: solar and home in kW, battery charge 0–100. Pass it to drive the card from your own data. |
| `defaultValue` | `{ solar: number; home: number; battery: number }` | `{ solar: 4.6, home: 2.1, battery: 64 }` | Starting readings for the simulation. |
| `history` | `{ solar: number[]; home: number[] }` |  | Today's kW by hour, 24 values each, for the curve. Generated when left out. |
| `selected / onSelectedChange` | `"solar" \| "battery" \| "grid" \| "home" \| null` |  | Picked node, controlled. |
| `defaultSelected` | `EnergyNode \| null` | `null` | Picked node on mount when uncontrolled. |
| `className` | `string` |  | Classes for the wrapper. |

## Where it fits

- **Smart home and solar apps**: Flow speed shows how much power moves where, so the card reads before any number does. Pairs with [Gauge](https://uibrik.com/components/gauge.md) (Pro).
- **Energy provider dashboards**: Tapping a node answers the usual question, where is this power coming from, without a separate chart. Pairs with [KPI Tile](https://uibrik.com/components/kpi-tile.md).
- **Climate tech landing pages**: A live diagram explains a battery and solar setup in a few seconds.

## Same shelf: Cards

- [Event Feed](https://uibrik.com/components/event-feed.md): A live feed card where new events drop in at the top with a soft highlight, push the rest down and age in real time.
- [File Card](https://uibrik.com/components/file-card.md): A document card whose corner curls on hover to show the next page, with older versions stacked behind the sheet.
- [Flag Rollout](https://uibrik.com/components/flag-rollout.md) (Pro): A feature flag rolling out to production. A grid of dots stands for the users: each step lights more of them in a wave, and exposed users who hit an error flash red. Error rate and p95 latency run as live sparklines, the error chart with its guardrail. Play steps the flag up on its own; if errors stay over the guardrail it rolls itself back and the grid drains in reverse. Pick any stage by hand, and every change lands in the log.
- [Flight Tracker](https://uibrik.com/components/flight-tracker.md) (Pro): A flight in one wide card. On the left, a dotted 3D globe with a faint graticule and the great-circle route lifted off the surface: the flown part trails in behind the plane, which flies over its own shadow while the camera turns with it. Drag the globe to look around and it eases back to the plane. Altitude, speed, distance and time to landing sit live on the globe, with play, pause and 1×, 4× and 16× speed; the destination pulses on approach and rings on touchdown. On the right, both airports with a progress line, aircraft, seat, bags and the weather on arrival, a scrubbable altitude profile that rings that point on the globe, and a timeline that lights up event by event. Stacks on narrow screens.
- [Integration Box](https://uibrik.com/components/integration-box.md) (Pro): An open box in a card with your integrations falling into it on a steady loop: each logo glides down from above, eases through the opening and sinks out of sight, then comes round again.
- [Live Cursors](https://uibrik.com/components/live-cursors.md) (Pro): A shared document where three teammates' cursors select, type and drag a card at their own pace, to show real-time collaboration.

## Ground rules

- Only the props above exist. To change anything else, edit the installed file.
- Keep the files in `components/uibrik/energy-flow/` so the import paths keep resolving.
- The playbook for working with the whole library: https://uibrik.com/llms.txt
