| 80 | }; |
| 81 | |
| 82 | render() { |
| 83 | const { disabled, value } = this.state; |
| 84 | return ( |
| 85 | <div> |
| 86 | <h2>combobox</h2> |
| 87 | <p> |
| 88 | <button type="button" onClick={this.toggleDisabled}> |
| 89 | toggle disabled |
| 90 | </button> |
| 91 | </p> |
| 92 | <div style={{ width: 300 }}> |
| 93 | <Select |
| 94 | className="custom-select" |
| 95 | disabled={disabled} |
| 96 | style={{ width: 500 }} |
| 97 | onChange={this.onChange} |
| 98 | onSelect={this.onSelect} |
| 99 | onInputKeyDown={this.onKeyDown} |
| 100 | notFoundContent="" |
| 101 | allowClear |
| 102 | placeholder="please select" |
| 103 | value={value} |
| 104 | mode="combobox" |
| 105 | backfill |
| 106 | prefix="Foobar" |
| 107 | suffixIcon={({ searchValue }) => { |
| 108 | if (searchValue) { |
| 109 | return '😺'; |
| 110 | } |
| 111 | return getSvg(arrowPath); |
| 112 | }} |
| 113 | clearIcon={getSvg(clearPath)} |
| 114 | removeIcon={getSvg(clearPath)} |
| 115 | menuItemSelectedIcon={singleItemIcon} |
| 116 | > |
| 117 | <Option value="jack"> |
| 118 | <b style={{ color: 'red' }}>jack</b> |
| 119 | </Option> |
| 120 | <Option value="lucy">lucy</Option> |
| 121 | <Option value="disabled" disabled> |
| 122 | disabled |
| 123 | </Option> |
| 124 | <Option value="yiminghe">yiminghe</Option> |
| 125 | </Select> |
| 126 | </div> |
| 127 | </div> |
| 128 | ); |
| 129 | } |
| 130 | } |
| 131 | |
| 132 | const children = []; |