@@ -78,19 +78,19 @@ When the value is changed, `onChange(selectedValueOrValues)` will fire.
78
78
var Select = require (' react-select' );
79
79
80
80
var options = [
81
- { value: ' one' , label: ' One' },
82
- { value: ' two' , label: ' Two' }
81
+ { value: ' one' , label: ' One' },
82
+ { value: ' two' , label: ' Two' }
83
83
];
84
84
85
85
function logChange (val ) {
86
- console .log (" Selected: " + val);
86
+ console .log (" Selected: " + val);
87
87
}
88
88
89
89
< Select
90
- name= " form-field-name"
91
- value= " one"
92
- options= {options}
93
- onChange= {logChange}
90
+ name= " form-field-name"
91
+ value= " one"
92
+ options= {options}
93
+ onChange= {logChange}
94
94
/ >
95
95
```
96
96
@@ -113,8 +113,8 @@ You can enable multi-value selection by setting `multi={true}`. In this mode:
113
113
* By default, selected options can be cleared. To disable the possibility of clearing a particular option, add ` clearableValue: false ` to that option:
114
114
``` javascript
115
115
var options = [
116
- { value: ' one' , label: ' One' },
117
- { value: ' two' , label: ' Two' , clearableValue: false }
116
+ { value: ' one' , label: ' One' },
117
+ { value: ' two' , label: ' Two' , clearableValue: false }
118
118
];
119
119
```
120
120
Note: the ` clearable ` prop of the Select component should also be set to ` false ` to prevent allowing clearing all fields at once
@@ -135,17 +135,17 @@ Unless you specify the property `autoload={false}` the control will automaticall
135
135
var Select = require (' react-select' );
136
136
137
137
var getOptions = function (input , callback ) {
138
- setTimeout (function () {
139
- callback (null , {
140
- options: [
141
- { value: ' one' , label: ' One' },
142
- { value: ' two' , label: ' Two' }
143
- ],
144
- // CAREFUL! Only set this to true when there are no more options,
145
- // or more specific queries will not be sent to the server.
146
- complete: true
147
- });
148
- }, 500 );
138
+ setTimeout (function () {
139
+ callback (null , {
140
+ options: [
141
+ { value: ' one' , label: ' One' },
142
+ { value: ' two' , label: ' Two' }
143
+ ],
144
+ // CAREFUL! Only set this to true when there are no more options,
145
+ // or more specific queries will not be sent to the server.
146
+ complete: true
147
+ });
148
+ }, 500 );
149
149
};
150
150
151
151
< Select .Async
@@ -168,8 +168,8 @@ import Select from 'react-select';
168
168
/*
169
169
* assuming the API returns something like this:
170
170
* const json = [
171
- * { value: 'one', label: 'One' },
172
- * { value: 'two', label: 'Two' }
171
+ * { value: 'one', label: 'One' },
172
+ * { value: 'two', label: 'Two' }
173
173
* ]
174
174
*/
175
175
@@ -183,9 +183,9 @@ const getOptions = (input) => {
183
183
}
184
184
185
185
< Select .Async
186
- name= " form-field-name"
187
- value= " one"
188
- loadOptions= {getOptions}
186
+ name= " form-field-name"
187
+ value= " one"
188
+ loadOptions= {getOptions}
189
189
/ >
190
190
```
191
191
@@ -200,8 +200,8 @@ var isLoadingExternally = true;
200
200
201
201
< Select
202
202
name= " form-field-name"
203
- isLoading= {isLoadingExternally}
204
- ...
203
+ isLoading= {isLoadingExternally}
204
+ ...
205
205
/ >
206
206
```
207
207
@@ -307,7 +307,7 @@ You can manipulate the input using the onInputChange and returning a new value.
307
307
308
308
``` js
309
309
function cleanInput (inputValue ) {
310
- // Strip all non-number characters from the input
310
+ // Strip all non-number characters from the input
311
311
return inputValue .replace (/ [^ 0-9 ] / g , " " );
312
312
}
313
313
0 commit comments