Then create a new instance of the control and add it to the map, ensuring the map has fully loaded first. const mapEl = document.createElement('div'); mapEl.setAttribute('id', 'map'); ...