Use the basicGUI api to show a GUI onclick
// Create GUI
let gui = feature.createBasicGui()
feature.on('click',e=>{
if(gui.showing){
// if GUI is showing, hide it. (act like a toggle)
gui.destroy()
return
}
// Add our first control:
gui.addText('Hello!')
// Call the GUI to show.
gui.show()
})
The scripts listens for a click and toggles a graphic interface on/off when clicked on.