Ask Your Question

Revision history [back]

To remove a dat.GUI element, you can use the following steps:

  1. Declare a variable to hold the element you want to remove. For example:
var gui = new dat.GUI();
var folder = gui.addFolder("My Folder");
var myControl = folder.add(myObject, "myProperty");
  1. Call the remove() method on the element to remove it. For example:
myControl.remove();
  1. If the element is part of a folder, you can also remove the folder using the removeFolder() method. For example:
folder.removeFolder();

Note: You can also hide elements using the domElement.style.display = 'none' method, but this does not remove the element from the dat.GUI instance.