ant-design/components/select/demo/search.tsx
afc163 0eed438d76
fix: Select width getting smaller when search (#41722)
* bump rc-select

* fix: Select width become 0px when searching
2023-04-10 13:11:51 +08:00

40 lines
734 B
TypeScript

import { Select } from 'antd';
import React from 'react';
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;