File tree Expand file tree Collapse file tree 2 files changed +32
-0
lines changed
react/components/EXPERIMENTAL_Select Expand file tree Collapse file tree 2 files changed +32
-0
lines changed Original file line number Diff line number Diff line change @@ -272,6 +272,33 @@ const options = [
272
272
</div>
273
273
` ` `
274
274
275
+ Without search input (good for mobile experience )
276
+
277
+ ` ` ` js
278
+ const options = [
279
+ {
280
+ value: 'first-option',
281
+ label: 'First Option',
282
+ },
283
+ {
284
+ value: 'second-option',
285
+ label: 'Second Option',
286
+ },
287
+ ]
288
+
289
+ ;<div>
290
+ <Select
291
+ label="Label"
292
+ options={options}
293
+ multi={false}
294
+ searchable={false}
295
+ onChange={values => {
296
+ console.log( ` [Select ] Selected : $ {JSON.stringify(values , null , 2 )}` )
297
+ }}
298
+ />
299
+ </div>
300
+ ` ` `
301
+
275
302
Loading state
276
303
277
304
` ` ` js
Original file line number Diff line number Diff line change @@ -41,6 +41,7 @@ class Select extends Component {
41
41
formatCreateLabel,
42
42
label,
43
43
loading,
44
+ searchable,
44
45
multi,
45
46
noOptionsMessage,
46
47
onChange,
@@ -80,6 +81,7 @@ class Select extends Component {
80
81
isClearable : clearable ,
81
82
isDisabled : disabled ,
82
83
isLoading : loading ,
84
+ isSearchable : searchable ,
83
85
isMulti : multi ,
84
86
noOptionsMessage,
85
87
inputId : this . inputId ,
@@ -204,6 +206,7 @@ class Select extends Component {
204
206
205
207
Select . defaultProps = {
206
208
multi : true ,
209
+ searchable : true ,
207
210
placeholder : 'Select...' ,
208
211
size : 'regular' ,
209
212
clearable : true ,
@@ -255,6 +258,8 @@ Select.propTypes = {
255
258
loading : PropTypes . bool ,
256
259
/** Text to display when loading options */
257
260
loadingMessage : PropTypes . string ,
261
+ /** Support disabling search input and only allow select to change values. */
262
+ searchable : PropTypes . bool ,
258
263
/** Support multiple selected options. */
259
264
multi : PropTypes . bool ,
260
265
/** Text to display when there are no options. ({inputValue}) => string | null */
You can’t perform that action at this time.
0 commit comments