Assets and styling
vUX modules bring their own stylesheets and load them for you. Your own stylesheet still decides how your components look, and it can restyle the ready-made widgets.
How stylesheets arrive
When the core loads, it reads data-library-root from your script tag and works out where the library's assets live: <library-root>/assets/. From there:
core.cssis added for you, about 300 ms after the page loads. Some core effects ($$.sm(...).slide,flip,scroll,fill) only add a class and rely on it.- Each widget links its own stylesheet, such as
assets/css/messageBox.css. Most do it ininitialize(). MessageBox and Skeleton link theirs as soon as they are imported, because they often show while the page is still loading.
Every stylesheet goes into document.head, after your own. That order matters when you override a rule (see below).
Warning
If data-library-root is missing or wrong, the modules still run but no stylesheet loads. See Installation.
Your components, your styles
A Component is your own markup cloned. It carries your classes and is styled by your stylesheet like anything else on the page. vUX adds no styles to it and never wraps it in a shadow root.
Restyling the widgets
The widgets expose their look in one of three ways. Each reference page says which ones it uses:
- Custom properties. MessageBox colours, for example, are custom properties on
.vmb-msg, so one rule in your stylesheet re-themes every message. configstyle strings. Builders such as Form Components take raw CSS declarations ("background:#fff; border:1px solid #ccc") and generate a stylesheet from them.- Plain classes. Anything else can be overridden from your own CSS.
Tip
A module's stylesheet loads after yours, so a selector that only ties with it on specificity loses. Scope your rule (.panel .resizeHandle instead of .resizeHandle) and it wins.
Do not use a shadow root
The library's selectors ($$.ss, $$.sa) stop at a shadow boundary, and the stylesheets vUX loads go into document.head, where they cannot reach inside one. Wrap a vUX component in a custom element if you like, but keep it in the light DOM.