Multiple Instance Demo
<!-- Option A: Single widget using ID -->
<div id="bushire-nz"></div>
<!-- Option B: Multiple widgets using class -->
<div class="bushire-nz"></div>
<div class="bushire-nz"></div>
<!-- Option C: Mix both (ID and class) -->
<div id="bushire-nz"></div>
<div class="bushire-nz"></div>
Place container div(s) where you want the widget to appear. Use an ID selector for a
single widget or a class selector for multiple widgets. The widget will initialize on
all matching elements based on your widgetId config.
<script type="module"
src="https://your-widget-domain.com/demo.js"></script>
Add this script tag to load the widget. The config is now embedded in the JS file.
// your-site.js
import createWidget from './main.js';
const yourConfig = {
widgetId: "your-site", // Used to find #your-site or .your-site
theme: {
primary: "#your-color",
accent: "#your-accent"
},
api: {
proxyBase: "https://your-api.com/api"
},
branding: {
logoUrl: "https://your-site.com/logo.png"
},
features: {
viaStops: true,
maxViaStops: 5,
returnTrips: true,
fileUpload: true
},
// ... rest of your config
};
createWidget(yourConfig);
Create custom JS files with embedded configuration. The widget will automatically
initialize on all elements matching #widgetId or .widgetId.
DOM ready state is handled automatically.