Spark Home
An animated, composable illustration of a home that shows live power flows between solar, battery, grid, heat pump, EV and the house, with sky, weather and time of day.
Usage
import {
SPARK_HOME_NODES,
SparkHome,
SparkHomeLabel,
SparkHomeLabelFace,
} from '@epilot/spark-ui/spark-home'<SparkHome state={state} devices={devices}>
{SPARK_HOME_NODES.map((node) => (
<SparkHomeLabel key={node} node={node} />
))}
</SparkHome>SparkHome draws the scene: the house, the energy flows between nodes, the sky for the given hour and weather, and the leader lines to each label. Each SparkHomeLabel places one value chip next to its node; render only the labels you need. Labels for devices that devices marks as absent render nothing, and their flows are dropped from the scene.
The roof picks up the page accent (--spark-9) and the scene follows the page's light or dark color scheme. Animation pauses while the scene is off screen.
Examples
Fewer devices
Pass devices to hide the heat pump, EV or battery. The camera reframes when the EV is absent.
Interactive labels
Children of SparkHomeLabel replace the default face. Wrap SparkHomeLabelFace in a button (for example a PopoverTrigger) to make a label interactive; clicking a node in the scene clicks that label's button too.
State
Power values are in kW. battery is positive while charging and negative while discharging; grid is positive while importing and negative while exporting.
interface SparkHomeState {
t: number
weather: 'sunny' | 'cloudy' | 'rainy' | 'snowy'
gridDown: boolean
solar: number
home: number
heatpump: number
ev: number
battery: number
grid: number
soc: number
}Accessibility
- The scene is a
sectionlandmark labelled byaria-label(default: "Live energy flow of your home"); pass a translated label. - The illustration itself is decorative; values are exposed as text in the labels.
- Interactive labels should wrap
SparkHomeLabelFacein a realbuttonso they are reachable by keyboard. - Animation respects
prefers-reduced-motion.
API Reference
SparkHome
| Prop | Type | Default |
|---|---|---|
state | SparkHomeState | required |
devices | SparkHomeDevices | all devices present |
festive | boolean | false (adds seasonal lights) |
aria-label | string | 'Live energy flow of your home' |
className | string | — |
SparkHomeLabel
| Prop | Type | Default |
|---|---|---|
node | SparkHomeNodeId | required |
children | ReactNode | <SparkHomeLabelFace node={node} /> |
SparkHomeLabelFace
| Prop | Type | Default |
|---|---|---|
node | SparkHomeNodeId | required |
name | ReactNode | English node name |
value | ReactNode | Node power from state, in W or kW |