react-toolbox/components/autocomplete/readme.md

52 lines
1.6 KiB
Markdown
Raw Normal View History

# Aside
```
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.|
| **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.|
| **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.|
## 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...");
```