Interactive floor plan in JavaScript, React and HTML
Updated November 2026
For a single plan, SVG with a path per room and pointer events is enough. When designers need to change the plan, or you want animation, switches and a mobile app from the same source, design it in ExodeUI and drive it from JavaScript: the plan is an .exode file, and your code sets inputs such as Night or fires triggers such as "pick Living".
The plan below is an .exode file in the Exode engine, inside an iframe. The buttons on the Architecture Studio page drive it with postMessage. How it was made.
Option 1: SVG and pointer events
Draw each room as its own path or polygon with an id, then listen for pointer events. It is fast for one plan and needs no library, but every hover style, label, animation and mobile layout is code you write and keep.
<svg viewBox="0 0 945 950" id="plan">
<path id="living" d="M405 0h540v360H405z" class="room" />
<path id="kitchen" d="M405 590h270v360H405z" class="room" />
</svg>
<script>
document.querySelectorAll('#plan .room').forEach((room) => {
room.addEventListener('pointerenter', () => room.classList.add('lit'));
room.addEventListener('pointerleave', () => room.classList.remove('lit'));
room.addEventListener('click', () => showRoom(room.id));
});
</script>Option 2: a floor plan SDK
Libraries and SDKs exist for indoor maps and building data (some read CAD or BIM). They suit facility apps with many floors and live data. They are heavier to set up, and design control is limited to what the SDK exposes.
Option 3: design it, then drive it from JavaScript
Draw the plan in Architecture Studio, add the hover, tap, switches and tour in the editor, and load the .exode file with a runtime. Your code only talks to named inputs. Designers can change the plan without touching your code, and the same file plays in React Native, SwiftUI and Flutter.
import { useState } from 'react';
import { ExodeUICanvas } from 'exodeui';
export function UnitPlan() {
const [engine, setEngine] = useState(null);
return (
<>
<ExodeUICanvas src="/plans/lakeview-2bhk.exode" fit="Contain" onReady={setEngine}
style={{ width: '100%', aspectRatio: '16 / 10' }} />
<button onClick={() => engine?.setInputBool('Night', true)}>Evening view</button>
<button onClick={() => engine?.fireTrigger('pick Living')}>Show the living room</button>
</>
);
}Plain HTML: an iframe and postMessage
If your site is not built with a framework, publish the plan and embed it in an iframe. A small listener inside the player turns messages into input changes, which is how the Architecture Studio page drives its demo.
<iframe id="plan" src="/architecture-studio/player/index.html" title="Floor plan"></iframe>
<button onclick="plan.contentWindow.postMessage({ type: 'exode-input', name: 'Night', value: true }, '*')">
Evening view
</button>The inputs in the example file
| Input | Type | What it does |
|---|---|---|
| Furniture | Boolean | Shows or hides all furniture |
| Dimensions | Boolean | Overall dimension lines and room sizes |
| Night | Boolean | Dark wash with a warm lamp in each room |
| Oak | Boolean | Oak floors in dry rooms |
| tour | Trigger | Room-by-room tour |
| pick <Room> | Trigger | Selects a room, as a tap does |
Design the plan and its interactions in the editor, then set inputs from your code. Free to start.
We make ExodeUI. Free Community plan; Professional is $5 a month, billed yearly.
Frequently asked questions
- Is there a JavaScript floor plan library?
- Yes, several, from small SVG helpers to building SDKs. If you want designers to own the look and motion, an .exode file with the exodeui runtime keeps the plan out of your code.
- Does it work with React?
- Yes. Install exodeui and render ExodeUICanvas with the file. Vue, Svelte, Angular, Solid and React Native runtimes work the same way.
- How big is the file?
- The example plan is about 460 KB uncompressed JSON for 393 layers, and compresses well over HTTP.
- Can I set room data from my API?
- Yes. Text and number inputs can be set at runtime, so names, prices or availability can come from your data.