# dat.GUI API Details about the classes, methods, and properties provided by dat.GUI. For more hands-on examples, see the dat.GUI [tutorial](http://workshop.chromeexperiments.com/examples/gui). ## Classes
GUI

A lightweight controller library for JavaScript. It allows you to easily manipulate variables and fire functions on the fly.

Controller

An "abstract" class that represents a given property of an object.

NumberControllerdat.controllers.Controller

Represents a given property of an object that is a number.

## GUI A lightweight controller library for JavaScript. It allows you to easily manipulate variables and fire functions on the fly. **Kind**: global class * [GUI](#GUI) * [new GUI([params])](#new_GUI_new) * [.domElement](#GUI+domElement) : DOMElement * [.parent](#GUI+parent) : dat.gui.GUI * [.autoPlace](#GUI+autoPlace) : Boolean * [.closeOnTop](#GUI+closeOnTop) : Boolean * [.preset](#GUI+preset) : String * [.width](#GUI+width) : Number * [.name](#GUI+name) : String * [.closed](#GUI+closed) : Boolean * [.load](#GUI+load) : Object * [.useLocalStorage](#GUI+useLocalStorage) : Boolean * [.add(object, property, [min], [max], [step])](#GUI+add) ⇒ [Controller](#Controller) * [.add(object, property, values)](#GUI+add2) ⇒ [Controller](#Controller) * [.addColor(object, property)](#GUI+addColor) ⇒ [Controller](#Controller) * [.remove(controller)](#GUI+remove) * [.destroy()](#GUI+destroy) * [.addFolder(name)](#GUI+addFolder) ⇒ dat.gui.GUI * [.removeFolder(folder)](#GUI+removeFolder) * [.open()](#GUI+open) * [.close()](#GUI+close) * [.hide()](#GUI+hide) * [.show()](#GUI+show) * [.getRoot()](#GUI+getRoot) ⇒ dat.gui.GUI * [.getSaveObject()](#GUI+getSaveObject) ⇒ Object ### new GUI([params]) | Param | Type | Default | Description | | --- | --- | --- | --- | | [params] | Object | | | | [params.name] | String | | The name of this GUI. | | [params.load] | Object | | JSON object representing the saved state of this GUI. | | [params.parent] | dat.gui.GUI | | The GUI I'm nested in. | | [params.autoPlace] | Boolean | true | | | [params.hideable] | Boolean | true | If true, GUI is shown/hidden by h keypress. | | [params.closed] | Boolean | false | If true, starts closed | | [params.closeOnTop] | Boolean | false | If true, close/open button shows on top of the GUI | **Example** ```js // Creating a GUI with options. var gui = new dat.GUI({name: 'My GUI'}); ``` **Example** ```js // Creating a GUI and a subfolder. var gui = new dat.GUI(); var folder1 = gui.addFolder('Flow Field'); ``` ### gui.domElement : DOMElement Outermost DOM Element **Kind**: instance property of [GUI](#GUI) ### gui.parent : dat.gui.GUI The parent GUI **Kind**: instance property of [GUI](#GUI) ### gui.autoPlace : Boolean Handles GUI's element placement for you **Kind**: instance property of [GUI](#GUI) ### gui.closeOnTop : Boolean Handles GUI's position of open/close button **Kind**: instance property of [GUI](#GUI) ### gui.preset : String The identifier for a set of saved values **Kind**: instance property of [GUI](#GUI) ### gui.width : Number The width of GUI element **Kind**: instance property of [GUI](#GUI) ### gui.name : String The name of GUI. Used for folders. i.e a folder's name **Kind**: instance property of [GUI](#GUI) ### gui.closed : Boolean Whether the GUI is collapsed or not **Kind**: instance property of [GUI](#GUI) ### gui.load : Object Contains all presets **Kind**: instance property of [GUI](#GUI) ### gui.useLocalStorage : Boolean Determines whether or not to use localStorage as the means for remembering **Kind**: instance property of [GUI](#GUI) ### gui.add(object, property, [min], [max], [step]) ⇒ [Controller](#Controller) Adds a new [Controller](#Controller) to the GUI. The type of controller created is inferred from the initial value of object[property]. For color properties, see [addColor](addColor). **Kind**: instance method of [GUI](#GUI) **Returns**: [Controller](#Controller) - The controller that was added to the GUI. | Param | Type | Description | | --- | --- | --- | | object | Object | The object to be manipulated | | property | String | The name of the property to be manipulated | | [min] | Number | Minimum allowed value | | [max] | Number | Maximum allowed value | | [step] | Number | Increment by which to change value | **Example** ```js // Add a string controller. var person = {name: 'Sam'}; gui.add(person, 'name'); ``` **Example** ```js // Add a number controller slider. var person = {age: 45}; gui.add(person, 'age', 0, 100); ``` ### gui.add(object, property, values) ⇒ [Controller](#Controller) Adds a new [Controller](#Controller) to the GUI. The type of controller created is a `