Skip to main content

Integration

There are four ways to embed a Waylocate map. They are not four products. They are four ways of doing the same thing, and the first three all end up holding the same WaylocateMap handle described in how the embed works.

Pick one based on how much of the element lifecycle you want to own.

Examples use a demonstration campus. Snippets on this site address ucba, a publicly available campus, and usually open the building muntz-hall. Some examples also pass a room prop when a specific location should be selected on load. Substitute your own campus slug once you have one. Slugs for your campus are listed in your Waylocate console, and the addressing rules are in the reference grammar.

Compare​

You render a component. The SDK owns the element inside it, and props keep the map in sync as your state changes.

import { CampusMap } from "@waylocate/embed/react";

<CampusMap
campus="ucba"
building="muntz-hall"
room="170"
className="h-[600px] w-full"
onSelectionChange={(selection, meta) => {
if (meta.source === "user") openPanel(selection.room);
}}
/>

Nothing in your JSX names a transport. If the way the map is delivered changes, this code does not.

Full guide

Which to use​

Ships an elementNeeds a bundlerGives you a handle
ReactThe SDK doesUsuallyYes, plus declarative props
JavaScriptThe SDK doesNoYes
Existing iframeYou doNoYes
Static iframeYou doNoNo

Two questions settle it in practice.

Do you need to command the map or react to it? If not, use the static iframe. It has no JavaScript to load, no failure modes, and no upgrade path to worry about.

Does the element already exist in markup you do not control? If so, use the existing-iframe path. Otherwise let the SDK create it, because that is the one choice that insulates you from changes to how the map is delivered.

Moving between them​

The paths are compatible by design. A static iframe becomes a controllable one by adding a host parameter to its URL and calling connect() on the element. An existing-iframe integration becomes a mount() integration by deleting the element from your markup and passing its parent as the container. The commands and events do not change in either direction.

Next​

Once you have a handle, controlling the map covers what you can do with it.