Smart UI Web Components work with current evergreen browsers and Node 18+ for local tooling; pin package versions to match your project policy.
Smart UI is distributed as the smart-webcomponents NPM package. You can also use the full download from the Download page.
npm install smart-webcomponents
<script type="module" src="node_modules/smart-webcomponents/source/modules/smart.map.js"></script>
<link rel="stylesheet" type="text/css" href="node_modules/smart-webcomponents/source/styles/smart.default.css" />
div (you mount programmatically with appendTo):Semantic element (id matches the selector in Smart()):
<smart-map id="map"></smart-map>
Host container (id matches appendTo on Smart.Map):
<div id="mapContainer"></div>
div:
<script type="module">
import 'node_modules/smart-webcomponents/source/modules/smart.map.js';
const mapOptions = {};
// Option A - semantic <smart-map> with id="map"
Smart('#map', class {
get properties() {
return mapOptions;
}
});
// Option B - host div id="mapContainer"
// const mapInstance = new Smart.Map({
// ...mapOptions,
// appendTo: '#mapContainer'
// });
// Option C - constructor(selector, options), then append the returned element yourself
// const myMap = new Smart.Map('#map', mapOptions);
// document.body.appendChild(myMap);
</script>
Uncomment Option B when you use the host div; use Option A when you use the semantic element. The Runtime cookbook also documents new Smart.Map('#map', mapOptions) with appendChild, and document.createElement('smart-map') with .props or Object.assign (all are valid patterns; do not combine overlapping patterns for the same instance unless you intend multiple components).
Alternative creation patterns and imperative APIs. These are all valid ways to create Smart UI components: semantic markup + Smart(); new Smart.Map({ ...options, appendTo: '#...' }); new Smart.Map('#map', mapOptions) plus appendChild on the returned element; and document.createElement('smart-map') then assigning options via .props or Object.assign on the element.
Constructor with a selector string and options, then append the returned element (for example const myMap = new Smart.Map('#map', mapOptions)):
const mapOptions = {};
const myMap = new Smart.Map('#map', mapOptions);
document.body.appendChild(myMap);
Create with document.createElement('smart-map'), assign properties (same as any custom element), then append:
const mapOptions = {};
const map = document.createElement('smart-map');
Object.assign(map, mapOptions);
document.body.appendChild(map);
Host on a div with appendTo (import the module, then instantiate when the document is ready; the container id must match appendTo):
import "../../source/modules/smart.map.js";
document.readyState === 'complete' ? init() : window.addEventListener('load', init);
function init() {
const mapOptions = {};
const map = new Smart.Map({
...mapOptions,
appendTo: '#mapContainer'
});
}
Append to the DOM:
const container = document.getElementById('map-container');
container.appendChild(map);
Remove from the DOM:
map.remove();
Set a property:
map.disabled = true; map.theme = 'dark';
Get a property value:
const isDisabled = map.disabled; const currentTheme = map.theme;
Invoke a method:
map.refresh(); map.focus();
Add event listener:
map.addEventListener('change', (event) => {
console.log('Event triggered:', event.detail);
});
Remove event listener:
const handleMapEvent = (event) => {
console.log('Event triggered:', event.detail);
};
map.addEventListener('change', handleMapEvent);
map.removeEventListener('change', handleMapEvent);
The Map component follows WAI-ARIA best practices:
For custom labeling, set aria-label or aria-labelledby attributes on the component.
Supported stacks: Smart UI targets Angular 17+, React 18+, Vue 3+, Node 18 LTS, and evergreen browsers; pin exact package versions to your org policy.