MCPcopy Create free account
hub / github.com/react-component/select / CustomIconComponent

Class CustomIconComponent

docs/examples/custom-icon.tsx:51–130  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

49);
50
51class CustomIconComponent extends React.Component {
52 state = {
53 disabled: false,
54 value: '',
55 };
56
57 onChange = (value, option) => {
58 console.log('onChange', value, option);
59 this.setState({
60 value,
61 });
62 };
63
64 onKeyDown = (e) => {
65 const { value } = this.state;
66 if (e.keyCode === 13) {
67 console.log('onEnter', value);
68 }
69 };
70
71 onSelect = (v, option) => {
72 console.log('onSelect', v, option);
73 };
74
75 toggleDisabled = () => {
76 const { disabled } = this.state;
77 this.setState({
78 disabled: !disabled,
79 });
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) {

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…