You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
40 lines
734 B
40 lines
734 B
2 years ago
|
import React from 'react';
|
||
|
import { Select } from 'antd';
|
||
|
|
||
|
const onChange = (value: string) => {
|
||
|
console.log(`selected ${value}`);
|
||
|
};
|
||
|
|
||
|
const onSearch = (value: string) => {
|
||
|
console.log('search:', value);
|
||
|
};
|
||
|
|
||
|
const App: React.FC = () => (
|
||
|
<Select
|
||
|
showSearch
|
||
|
placeholder="Select a person"
|
||
|
optionFilterProp="children"
|
||
|
onChange={onChange}
|
||
|
onSearch={onSearch}
|
||
|
filterOption={(input, option) =>
|
||
|
(option?.label ?? '').toLowerCase().includes(input.toLowerCase())
|
||
|
}
|
||
|
options={[
|
||
|
{
|
||
|
value: 'jack',
|
||
|
label: 'Jack',
|
||
|
},
|
||
|
{
|
||
|
value: 'lucy',
|
||
|
label: 'Lucy',
|
||
|
},
|
||
|
{
|
||
|
value: 'tom',
|
||
|
label: 'Tom',
|
||
|
},
|
||
|
]}
|
||
|
/>
|
||
|
);
|
||
|
|
||
|
export default App;
|