2015-10-29 09:42:14 +03:00
|
|
|
# Autocomplete
|
2015-07-02 14:18:07 +03:00
|
|
|
|
|
|
|
```
|
|
|
|
var Autocomplete = require('react-toolbox/components/autocomplete');
|
|
|
|
|
|
|
|
var data = [
|
|
|
|
{ '1': 'Never' },
|
|
|
|
{ '2': 'Every Night' },
|
|
|
|
{ '3': 'Weeknights' },
|
|
|
|
{ '4': 'Weekends' },
|
|
|
|
{ '5': 'Weekly' },
|
|
|
|
];
|
|
|
|
|
|
|
|
<Autocomplete label="Period" dataSource={data} value='4' />
|
|
|
|
```
|
|
|
|
|
|
|
|
## Properties
|
|
|
|
|
|
|
|
| Name | Type | Default | Description|
|
|
|
|
|:- |:-: | :- |:-|
|
2015-07-07 12:30:22 +03:00
|
|
|
| **className** | String | | Sets the class-styles of the Component.|
|
|
|
|
| **dataSource** | Object | | JSON data representing all items in the component.|
|
|
|
|
| **disabled** | Boolean | | If true, component will be disabled.|
|
2015-07-02 14:18:07 +03:00
|
|
|
| **error** | String | | Sets the error string.|
|
2015-07-07 12:30:22 +03:00
|
|
|
| **label** | String | | The text string to use for the floating label element.|
|
|
|
|
| **multiple** | Bool | true | If true, component can hold multiple values.|
|
2015-07-02 14:18:07 +03:00
|
|
|
| **onChange** | Function | | Callback function that is fired when the components's value changes.|
|
2015-07-07 12:30:22 +03:00
|
|
|
| **required** | Boolean | | If true, component needs has a value.|
|
|
|
|
| **value** | String | | Default value using JSON data.|
|
2015-07-02 14:18:07 +03:00
|
|
|
|
|
|
|
## Methods
|
|
|
|
|
|
|
|
#### getValue
|
|
|
|
Returns the value of the input.
|
|
|
|
|
|
|
|
```
|
|
|
|
input_instance.getValue();
|
|
|
|
```
|
|
|
|
|
|
|
|
#### setValue
|
|
|
|
Sets the value of the input element.
|
|
|
|
|
|
|
|
```
|
|
|
|
input_instance.setValue(newValue);
|
|
|
|
```
|
|
|
|
|
|
|
|
#### setError
|
|
|
|
|
|
|
|
```
|
|
|
|
input_instance.setError("Something is wrong...");
|
|
|
|
```
|