Formats
Borda is distributed in three module formats. Each format has a development build (readable, with comments) and a minified production build. All variants export the same API surface — the difference is how the module is loaded by the consumer.
ES Module
The recommended format for projects using a bundler (Vite, Webpack 5+, Rollup, esbuild). ES Modules support static analysis, tree-shaking, and modern import/export syntax.
| File | Description |
|---|---|
borda.es.js | Development build — unminified, suitable for debugging |
borda.min.es.js | Production build — minified and optimized |
The main and module fields in package.json point to this build, so bundlers resolve it automatically.
import { useBorda } from '@retoo/borda';
import '@retoo/borda/styles';
const borda = useBorda();
UMD
Universal Module Definition — works via <script> tags in the browser, AMD loaders, and CommonJS require(). Use this for environments without a bundler: static HTML pages, WordPress, Webflow, Squarespace, or any CMS that allows custom scripts.
| File | Description |
|---|---|
borda.umd.js | Development build |
borda.min.umd.js | Production build |
<link rel="stylesheet" href="https://unpkg.com/@retoo/borda/dist/borda.css" />
<script src="https://unpkg.com/@retoo/borda/dist/borda.min.umd.js"></script>
<script>
const borda = window.bordaWidget();
borda.mount({
steps: [
{
target: '#element',
title: 'Welcome',
description: 'Getting started.',
placement: 'bottom-center',
},
],
});
</script>
window.bordaWidget() — no need to access a namespace object.CommonJS
For Node.js environments, SSR frameworks, or legacy build systems that use require().
| File | Description |
|---|---|
borda.cjs.js | Development build |
borda.min.cjs.js | Production build |
const { useBorda } = require('@retoo/borda');
const borda = useBorda();
Custom Element
Register Borda as a native Web Component to use it in any framework — or vanilla HTML:
Register the element
import { defineBordaElement } from '@retoo/borda';
import '@retoo/borda/styles';
defineBordaElement();
Use in HTML
<borda-tour-widget></borda-tour-widget>
Stylesheets
CSS must be imported separately regardless of the JS format. Without styles, the widget mounts into the DOM but renders without any visual appearance.
| Import path | Description |
|---|---|
@retoo/borda/styles | Development build — unminified, with source maps |
@retoo/borda/styles/min | Production build — minified |
// ES Module / bundler
import '@retoo/borda/styles'; // dev
import '@retoo/borda/styles/min'; // prod
<!-- UMD / script tag -->
<link rel="stylesheet" href="https://unpkg.com/@retoo/borda/dist/borda.css" />