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.
28 lines
576 B
28 lines
576 B
2 years ago
|
import React from 'react';
|
||
|
import { Select } from 'antd';
|
||
|
|
||
|
const handleChange = (value: { value: string; label: React.ReactNode }) => {
|
||
|
console.log(value); // { value: "lucy", key: "lucy", label: "Lucy (101)" }
|
||
|
};
|
||
|
|
||
|
const App: React.FC = () => (
|
||
|
<Select
|
||
|
labelInValue
|
||
|
defaultValue={{ value: 'lucy', label: 'Lucy (101)' }}
|
||
|
style={{ width: 120 }}
|
||
|
onChange={handleChange}
|
||
|
options={[
|
||
|
{
|
||
|
value: 'jack',
|
||
|
label: 'Jack (100)',
|
||
|
},
|
||
|
{
|
||
|
value: 'lucy',
|
||
|
label: 'Lucy (101)',
|
||
|
},
|
||
|
]}
|
||
|
/>
|
||
|
);
|
||
|
|
||
|
export default App;
|