Skip to content

Commit

Permalink
readme updated to include object argument model.
Browse files Browse the repository at this point in the history
  • Loading branch information
msawired committed Jun 5, 2023
1 parent 189260d commit 988d9c9
Showing 1 changed file with 17 additions and 3 deletions.
20 changes: 17 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -72,9 +72,9 @@ OPC.button(variableName, buttonText);
//example: OPC.button('myButton', 'Click Me!');
```

**Default values**
**Defaults**

None
defaultValue: 'Click Me!'

### Color

Expand All @@ -85,7 +85,7 @@ OPC.color(variableName, defaultValue);
//example: OPC.color('bg_color', '#ffffff');
```

**Default values**
**Defaults**

defaultValue: #333333

Expand All @@ -112,6 +112,20 @@ OPC.palette('currentPalette',

defaultValue: first option in paletteOptions array

## Passing Arguments as Objects
All OPC components can also be created by passing an object of arguments, such as below. This also allows passing in additional parameters [label, description].
```javascript
OPC.slider({
name: 'stroke_weight',
value: 3,
min: 1,
max: 10,
step:1,
label: 'Circle Border',
description: 'Changes the border size of the circle'
});
```
Note that, the object values are copied and are **not** referenced; Changing the object arguments at a later time will not effect the OPC component.

## Events

Expand Down

0 comments on commit 988d9c9

Please sign in to comment.