Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add dropdown documentation #267

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 23 additions & 0 deletions API.md
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@ manipulate variables and fire functions on the fly.
* [.load](#GUI+load) : <code>Object</code>
* [.useLocalStorage](#GUI+useLocalStorage) : <code>Boolean</code>
* [.add(object, property, [min], [max], [step])](#GUI+add) ⇒ [<code>Controller</code>](#Controller)
* [.add(object, property, values)](#GUI+add2) ⇒ [<code>Controller</code>](#Controller)
* [.addColor(object, property)](#GUI+addColor) ⇒ [<code>Controller</code>](#Controller)
* [.remove(controller)](#GUI+remove)
* [.destroy()](#GUI+destroy)
Expand Down Expand Up @@ -171,6 +172,28 @@ gui.add(person, 'name');
var person = {age: 45};
gui.add(person, 'age', 0, 100);
```
<a name="GUI+addColor2"></a>

### gui.add(object, property, values) ⇒ [<code>Controller</code>](#Controller)
Adds a new [Controller](#Controller) to the GUI. The type of controller created
is a `<select>` dropdown.

**Kind**: instance method of [<code>GUI</code>](#GUI)
**Returns**: [<code>Controller</code>](#Controller) - The controller that was added to the GUI.

| Param | Type | Description |
| --- | --- | --- |
| object | <code>Object</code> | The object to be manipulated |
| property | <code>String</code> | The name of the property to be manipulated |
| values | <code>Array|Object</code> | Array or Dictionary of possible options' values |

**Example**
```js
// Add a dropdown controller.
var person = {name: 'Sam'};
gui.add(person, 'name', ['Sam', 'Alex', 'Ray']);
gui.add(person, 'name', {'Sam': 'Sammy', 'Alex': 'Alexis', 'Ray': 'Riley'});
```
<a name="GUI+addColor"></a>

### gui.addColor(object, property) ⇒ [<code>Controller</code>](#Controller)
Expand Down