vUXDocs v4.1.0

Installation

vUX runs straight from its source files. Put the library where your page can reach it, point one script tag at it, and import the modules you need.

1. Get the library

Clone or download the repository from GitHub and serve its folder with your site, for example at /lib/vUX/. Nothing needs installing or building.

bash
git clone https://github.com/VilsHub/vUX.git lib/vUX

Tip

For production, ./minify.sh in the repository writes a minified copy to dist/<version>/, with every file in the same place. Serve that folder instead; nothing else changes. It needs Node 18 or later.

2. Mark your script tag

vUX finds its own files from the module script on your page. That tag needs two attributes:

html
<script type="module" src="main.js" data-id="vUX" data-library-root="/lib/vUX/"></script>
AttributeWhat it does
data-id="vUX"Marks the script tag vUX reads its settings from.
data-library-rootThe path (absolute or relative) to the vUX folder. Every stylesheet and asset a module needs is loaded from <library-root>/assets/.

Warning

Without these two attributes the modules still load, but no stylesheet does, so widgets appear unstyled.

3. Import modules

Each module is one file named vUX-<module>.js and exports one constructor:

js
import { MessageBox } from "/lib/vUX/vUX-messageBox.js";
import { Store } from "/lib/vUX/vUX-store.js";

const box = new MessageBox();
box.initialize();
box.success("vUX is loaded");

Importing any module also loads the core, so $$ and the helper functions are available as globals from then on. To use only the core utilities, import vUX-core.js.

Note

Run vUxModules in the browser console to list every module file you can import.

4. Serve over HTTP

ES modules do not load from file:// addresses. During development, any static server works:

bash
python3 -m http.server 8000

Next

Your first component builds a small reusable component from your own markup.