Skip to content

Commit

Permalink
New methods .blur and .focus
Browse files Browse the repository at this point in the history
  • Loading branch information
soyjavi committed Aug 10, 2015
1 parent aaa35a3 commit 5464fc5
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 3 deletions.
12 changes: 9 additions & 3 deletions components/input/index.cjsx
Expand Up @@ -88,11 +88,17 @@ module.exports = React.createClass
</div>

# -- Extends
blur: ->
@refs.input.blur?()

focus: ->
@refs.input.focus?()

getValue: ->
@refs.input?.getDOMNode()[if @state.touch then 'checked' else 'value']

setValue: (data) ->
@setState value: data

setError: (data = 'Unknown error') ->
@setState error: @props.error or data

setValue: (data) ->
@setState value: data
16 changes: 16 additions & 0 deletions components/input/input.md
Expand Up @@ -27,6 +27,22 @@ var Input = require('react-toolbox/components/input');

## Methods

#### focus
The focus event is sent to an element when it gains focus.

```
input_instance.focus();
```


#### blur
The blur event is sent to an element when it loses focus

```
input_instance.blur();
```


#### getValue
Returns the value of the input.

Expand Down

0 comments on commit 5464fc5

Please sign in to comment.