An isometric building in SVG, drawn in code with React
Draw an isometric building in React with a tiny projection function: boxes to faces, a battery filled to its charge, power flowing along cables and labels on dotted leaders.
7 min read
Isometric drawings look complex, but they come from one small function. Our energy page draws a whole building that way.
One projection function
A point in the building's space (x, y, z) maps to the screen by shifting right for x minus y, down for x plus y, and up for z. Everything else is built on that.
src/registry/landing-pages/wattline/iso.ts
// Isometric drawing helpers for the building diagram: a point in the building's own units (x along one side, y along
// the other, z up) projected onto the 900 × 440 drawing.
const ORIGIN = { x: 430, y: 200 };
const COS30 = 0.866;
export type Point = [number, number, number];
export function iso([x, y, z]: Point): [number, number] {
return [ORIGIN.x + (x - y) * COS30, ORIGIN.y + (x + y) * 0.5 - z];
}
// An SVG points string for a polygon through these building points.
export function poly(points: Point[]): string {
return points.map((point) => iso(point).join(",")).join(" ");
}
export interface Box {
x: [number, number];
y: [number, number];
z: [number, number];
}
// The three faces of a box the viewer can see: its top, the face toward +x and the face toward +y.
export function facesOf({ x: [x0, x1], y: [y0, y1], z: [z0, z1] }: Box) {
return {
top: poly([
[x0, y0, z1],
[x1, y0, z1],
[x1, y1, z1],
[x0, y1, z1],
]),
right: poly([
[x1, y0, z0],
[x1, y1, z0],
[x1, y1, z1],
[x1, y0, z1],
]),
front: poly([
[x0, y1, z0],
[x1, y1, z0],
[x1, y1, z1],
[x0, y1, z1],
]),
};
}
// A path string through building points.
export function pathOf(points: Point[]): string {
return points.map((point, index) => `${index === 0 ? "M" : "L"} ${iso(point).join(" ")}`).join(" ");
}
Boxes become faces
A box has three visible faces from this angle: top, right and front. Give each a slightly different shade and you have depth without lighting. The building, the HVAC unit, the battery and the meter are all boxes.
src/registry/landing-pages/wattline/building-parts.tsx
import { facesOf, pathOf, poly, type Box } from "./iso";
export const BUILDING: Box = { x: [0, 200], y: [0, 150], z: [0, 150] };
export const HVAC: Box = { x: [128, 186], y: [108, 140], z: [150, 172] };
export const BATTERY: Box = { x: [262, 322], y: [36, 96], z: [0, 92] };
export const METER: Box = { x: [36, 70], y: [196, 222], z: [0, 58] };
const FLOORS = [30, 60, 90, 120];
const MULLIONS = [25, 50, 75, 100, 125, 150, 175];
const PANEL_COLS = [16, 54, 92, 130, 168];
const PANEL_ROWS = [14, 44, 74];
// A box drawn as three lit faces: the top brightest, the two sides a step darker each.
export function IsoBox({
box,
top = "fill-white",
right = "fill-zinc-50",
front = "fill-zinc-100",
}: {
box: Box;
top?: string;
right?: string;
front?: string;
}) {
const faces = facesOf(box);
return (
<g className="stroke-zinc-400" strokeWidth={1} strokeLinejoin="round">
<polygon points={faces.right} className={right} />
<polygon points={faces.front} className={front} />
<polygon points={faces.top} className={top} />
</g>
);
}
// The building: its box, floor lines and window mullions on both visible faces, and solar panels across the roof.
export function Building() {
const [x0, x1] = BUILDING.x;
const [y0, y1] = BUILDING.y;
const roof = BUILDING.z[1];
return (
<g>
<IsoBox box={BUILDING} />
<g className="stroke-zinc-300" strokeWidth={0.75}>
{FLOORS.map((z) => (
<path
key={`f${z}`}
d={`${pathOf([
[x1, y0, z],
[x1, y1, z],
])} ${pathOf([
[x0, y1, z],
[x1, y1, z],
])}`}
fill="none"
/>
))}
{MULLIONS.filter((x) => x < x1).map((x) => (
<path
key={`m${x}`}
d={pathOf([
[x, y1, 0],
[x, y1, roof],
])}
/>
))}
{MULLIONS.filter((y) => y < y1).map((y) => (
<path
key={`n${y}`}
d={pathOf([
[x1, y, 0],
[x1, y, roof],
])}
/>
))}
</g>
<g className="fill-zinc-100 stroke-zinc-400" strokeWidth={0.75}>
{PANEL_ROWS.flatMap((y) =>
PANEL_COLS.map((x) => (
<polygon
key={`${x}-${y}`}
points={poly([
[x, y, roof],
[x + 32, y, roof],
[x + 32, y + 24, roof],
[x, y + 24, roof],
])}
/>
)),
)}
</g>
<IsoBox box={HVAC} />
</g>
);
}
// The battery: a box whose two visible faces fill with the accent up to its charge.
export function Battery({ percent }: { percent: number }) {
const [x0, x1] = BATTERY.x;
const [y0, y1] = BATTERY.y;
const level = BATTERY.z[0] + ((BATTERY.z[1] - BATTERY.z[0]) * percent) / 100;
return (
<g>
<IsoBox box={BATTERY} />
<g className="fill-lime-300 stroke-lime-500" strokeWidth={0.75}>
<polygon
points={poly([
[x1, y0, 0],
[x1, y1, 0],
[x1, y1, level],
[x1, y0, level],
])}
/>
<polygon
points={poly([
[x0, y1, 0],
[x1, y1, 0],
[x1, y1, level],
[x0, y1, level],
])}
/>
</g>
<path
d={pathOf([
[x1, y0, level],
[x1, y1, level],
[x0, y1, level],
])}
fill="none"
className="stroke-lime-600"
strokeWidth={1.25}
/>
</g>
);
}
Things that move
Power flows along the cables as a dashed stroke whose offset animates, and stays still with reduced motion. Readings sit in labels joined to their part by dotted leaders with small square anchors.
src/registry/landing-pages/wattline/building-diagram.tsx
"use client";
import { motion } from "motion/react";
import { usePrefersReducedMotion } from "@/hooks/use-prefers-reduced-motion";
import { BATTERY, BUILDING, Battery, Building, HVAC, IsoBox, METER } from "./building-parts";
import { iso, pathOf, poly, type Point } from "./iso";
import type { Reading } from "./types";
// Where each reading's connector lands on the drawing, and where its label sits.
const ANCHORS: Record<Reading["target"], { at: Point; label: [number, number] }> = {
solar: { at: [90, 40, 150], label: [10, 60] },
hvac: { at: [186, 124, 172], label: [700, 86] },
battery: { at: [322, 66, 70], label: [700, 236] },
grid: { at: [36, 209, 58], label: [10, 300] },
};
const LABEL = { width: 190, height: 54 };
const GROUND: Point[] = [
[-40, -30, 0],
[350, -30, 0],
[350, 250, 0],
[-40, 250, 0],
];
// Cables on the ground: battery to building, and meter to building.
const BATTERY_CABLE: Point[] = [
[BATTERY.x[0], 66, 0],
[BUILDING.x[1], 66, 0],
];
const GRID_CABLE: Point[] = [
[53, METER.y[0], 0],
[53, BUILDING.y[1], 0],
];
// A live reading in a small bordered label, joined to its part of the building by a dotted line.
function ReadingLabel({ reading }: { reading: Reading }) {
const { at, label } = ANCHORS[reading.target];
const [ax, ay] = iso(at);
const [lx, ly] = label;
const edgeX = lx < ax ? lx + LABEL.width : lx;
return (
<g>
<path
d={`M ${ax} ${ay} L ${edgeX} ${ly + LABEL.height / 2}`}
fill="none"
className="stroke-zinc-400"
strokeWidth={1}
strokeDasharray="2 4"
/>
<rect x={ax - 3} y={ay - 3} width={6} height={6} className="fill-zinc-950" />
<rect x={lx} y={ly} width={LABEL.width} height={LABEL.height} rx={6} className="fill-white stroke-zinc-300" />
<text x={lx + 12} y={ly + 18} fontSize={11} className="fill-zinc-500 font-mono">
{reading.key.toUpperCase()}
</text>
<text x={lx + 12} y={ly + 34} fontSize={13} className="fill-zinc-950 font-mono font-medium">
{reading.value}
</text>
</g>
);
}
// Power moving along a cable: dashes that travel from source to building, still for reduced motion.
function Flow({ points, className }: { points: Point[]; className: string }) {
const isStill = usePrefersReducedMotion();
return (
<motion.path
d={pathOf(points)}
fill="none"
strokeWidth={2.5}
strokeLinecap="round"
strokeDasharray="4 8"
className={className}
animate={isStill ? undefined : { strokeDashoffset: [0, -24] }}
transition={{ duration: 0.9, repeat: Infinity, ease: "linear" }}
/>
);
}
interface BuildingDiagramProps {
readings: Reading[];
batteryPercent: number;
}
// One customer building drawn in isometric line work: the solar roof and the HVAC unit on it, the battery filling to
// its charge, the grid meter, the cables between them carrying power, and every live reading labelled at its part.
export function BuildingDiagram({ readings, batteryPercent }: BuildingDiagramProps) {
return (
<svg
viewBox="0 30 900 380"
className="h-auto w-full"
role="img"
aria-label={`Building diagram: ${readings.map((reading) => `${reading.key} ${reading.value}`).join(", ")}`}
>
<polygon points={poly(GROUND)} className="fill-zinc-50/60 stroke-zinc-300" strokeDasharray="3 5" />
<path d={pathOf(BATTERY_CABLE)} className="stroke-zinc-300" strokeWidth={4} strokeLinecap="round" />
<path d={pathOf(GRID_CABLE)} className="stroke-zinc-300" strokeWidth={4} strokeLinecap="round" />
<Flow points={BATTERY_CABLE} className="stroke-lime-500" />
<Flow points={[...GRID_CABLE].reverse()} className="stroke-zinc-500" />
<IsoBox box={METER} />
<Building />
<Battery percent={batteryPercent} />
<IsoBox
box={{
x: [HVAC.x[0] + 8, HVAC.x[0] + 24],
y: [HVAC.y[0] + 8, HVAC.y[0] + 24],
z: [HVAC.z[1], HVAC.z[1] + 3],
}}
top="fill-zinc-300"
/>
{readings.map((reading) => (
<ReadingLabel key={reading.key} reading={reading} />
))}
</svg>
);
}
More articles

7 min read
A POS and payments landing page template for 2027: tap a card, watch it ring up
How our payments and point-of-sale landing page template works: a card terminal drawn in code you tap a card on, a live payments dashboard, a best-hour heat grid and a fee calculator written out as a check.

7 min read
A legal AI landing page template for 2027, on pleading paper
How our legal AI landing page template is built: pleading paper as the page's texture, a product dashboard in the hero, workflows as exhibits in a binder, and a closing worded as a clause.

7 min read
An AI voice agent landing page template for 2027, built on a phone keypad
How our AI voice agent landing page template works: a live call on frosted glass over a photo, a waveform with a playhead, a call that becomes a work order, and every section as a key on the phone.

7 min read
An AI agent platform landing page template for 2027 that runs your message
How our AI agent platform landing page template works: a workflow drawn as a constellation, a run that lights each step it travels, a customer email the visitor can rewrite, and a rule they own.

7 min read
A clinic scheduling landing page template for 2027: drag a patient into a free slot
How our clinic scheduling software landing page template works: the practice's real week on frosted glass, a cancellation that the waitlist fills, a sticky day story and a changelog as proof.

7 min read
A real estate landing page template for 2027 under a golden-hour sky
How our real estate and new homes landing page template works: a hand holding a listing app with room cards flying out, glossy buying steps, a two-card home browser and a mortgage calculator.

5 min read
Liquid glass navbar in React and Tailwind for 2027
Build an Apple-style liquid glass navbar in React: a frosted pill that blurs and brightens what scrolls under it, a lit rim, and a glass lens that glides under the hovered link with Motion.

5 min read
A mega menu in React that glides between menus (2027)
Build a mega menu dropdown in React with Motion that stays open as you move between menus: the panel resizes to fit each one and the content slides in from the side the pointer came from.

4 min read
A painted sky hero section for travel websites (2027)
How our travel website hero is built: a full-bleed painted golden-hour sky, a paper plane that banks and bobs on the wind, an Instrument Serif headline and coral pill buttons.

6 min read
A neo-brutalist hero section with a live CRM board (2027)
How our neo-brutalist hero works: hard shadows and colour blocks around a live pipeline board where a teammate's cursor carries deals across columns, run by a small state machine.

6 min read
Drag and drop file upload in React, where files stack as boxes (2027)
Build a drag and drop file upload component in React: files become boxes on a pallet as tall as they are large, a dot board that lights under a dragged file, real progress and capacity limits.

5 min read
Toast notifications in React, printed like a receipt (2027)
Build toast notifications in React that a small receipt printer feeds out on paper in jerks, with the real time on each, earlier ones riding up the strip and the oldest dropping off.

6 min read
An agency pricing section that shows real availability (2027)
Build a pricing section in React that sells scarcity honestly: each plan shows the months it can still start in, booked ones struck through, with a per-project or retainer switch and counting prices.
6 min read
A sticky scroll product tour where the camera pans the real app (2027)
Build a sticky scroll feature section in React: features scroll by while the product screen stays pinned, and a camera pans and zooms to the part each feature is about.

5 min read
A navbar made of folder tabs: building it in React
Build a navbar whose links are paper folder tabs standing on the page: the section you're reading steps forward and joins the page, with a layout that moves and recolours only.

6 min read
A hero section that connects every app, one by one
Build a SaaS hero where the product's hub fans out to every app it integrates with, branches drawing in and waiting apps connecting one after another, in React and Motion.
6 min read
Annotated product screenshots: notes that point at the real screen
Build a feature section where notes sit around one product screen and pointing at a note draws a leader line to the exact part it describes, which lifts, in React.

6 min read
A stats section that proves itself: numbers, people and live clocks
Build a proof section as a bento in React: a counted headline number with a bar per year, the team with live local times, one quote, the tools used and client names drifting past.

6 min read
A testimonial carousel you can drag, flick and step through
Build a draggable testimonial carousel in React with Motion: card-by-card snapping, flick momentum, a readable scroll rail, arrow keys and upright swipes left to the page.

6 min read
An FAQ as a conversation: a person who types the answer
Build a chat-style FAQ in React: tap a question and watch a real person read it, type the answer in bursts, slip on a word and fix it, then send.

6 min read
A call to action that writes the project brief
Build a closing CTA section in React where visitors pick chips to build a one-line brief, and the button turns into exactly that project with real kick-off and launch dates.

6 min read
A footer with a newsletter and a wordmark that leans toward you
Build a landing page footer in React: a newsletter form with a real success state, link columns, live studio clocks and a full-width wordmark whose letters rise toward the pointer.

6 min read
Prompt to page: an AI hero where the site builds itself
Build a describe-it-and-it-gets-built showcase in React: a prompt types itself while skeleton blocks glide into a wireframe page, then rearrange for the next prompt.

6 min read
Hold to confirm: a button you have to mean
Build a press-and-hold confirm button in React drawn as a rubber stamp: a ring that fills while held, falls back if let go, and an uneven red imprint that lands on the document.

9 min read
The 20 best React UI components for 2027, picked from 110
We reviewed all 110 free components in DeliverWebsite UI and picked the 20 best for 2027: landing page templates, a liquid glass navbar, a file upload, toasts, pricing and more, each in React, Tailwind and Motion.

6 min read
How to build a zipper reveal animation in React
Build a draggable zipper that unzips to reveal content in React with Motion: one motion value, two clip-paths, a spring that decides open or shut, and a keyboard path.

6 min read
Scratch card in React: a canvas foil that reveals a coupon
Build a scratch-to-reveal coupon in React with a canvas: destination-out strokes, sampling how much is cleared, a falling foil and an accessible reveal button.

5 min read
Pull cord animation in React: a roller blind announcement
Build a pull cord that drops a roller blind announcement in React with Motion drag: an elastic bead, a stretching cord, a threshold and a spring-loaded blind.

7 min read
Building an interactive org chart in React for a recruiting page
How our recruiting landing page uses an org chart as its hero: open seats that expand into a role's pipeline with shared layout animations, cards dealt to a panel and a hire dropped into a seat.

6 min read
A receipt that prints itself: odometer numbers and torn paper in React
How our spend management landing page prints a receipt line by line, rolls totals on odometer digits and tears its edges, with React, Tailwind and Motion.

6 min read
Split-flap display in React: a departure board that flips in 3D
Build a split-flap departure board in React: tiles that scramble through letters, a falling 3D flap on each change, staggered rows and a server-safe random stand-in.

6 min read
Marbled paper backgrounds on a canvas, without WebGL
Draw a soft marbled background in plain canvas 2D: value noise folded through itself, combed into veins, drawn small and scaled up, capped at 12 frames a second.

6 min read
A PIN login for shift workers, drawn as a time clock
Build a PIN sign-in for shared tablets in React: a real password field with large keys, a time clock drawn in code, and a card that drops in and gets stamped with the real time.

5 min read
An account switcher drawn as a key rack
Build a choose-an-account page in React where every saved account hangs as a key: swinging keys on springs, lifting one to sign in, and an empty hook for a new account.

6 min read
A pricing calculator drawn as a tape measure
Build a website cost calculator in React that measures the project as a tape: ticking pieces pulls the tape out week by week and slides the price along, with transforms only.

7 min read
Landing page design trends for 2027: what we are building, and what we stopped
Seven landing page design trends for 2027, from a team that ships React templates every week: interfaces you touch, real photos over AI images, one idea per page, and the habits to drop.

7 min read
How we built a login page where the password cuts a key
A React login page that turns the password into a brass key as you type: the hash behind the cuts, the SVG that animates them, and the mistakes we made first.

8 min read
A scroll-story landing page in React: one pinned stage, one clock
How to build a pinned scroll story in React with Motion: sticky positioning, one scroll-driven clock, and a single object that changes state scene by scene.

5 min read
OTP input in React: use one real input, not six
Six separate boxes break paste, autofill and screen readers. Build a six-digit code input in React from a single input with the boxes drawn underneath it.
