mirror of
https://github.com/ant-design/ant-design.git
synced 2025-01-06 10:48:01 +08:00
55 lines
1.3 KiB
TypeScript
55 lines
1.3 KiB
TypeScript
|
import React from 'react';
|
||
|
import { Select } from 'antd';
|
||
|
|
||
|
const { Option } = Select;
|
||
|
|
||
|
const handleChange = (value: string[]) => {
|
||
|
console.log(`selected ${value}`);
|
||
|
};
|
||
|
|
||
|
const App: React.FC = () => (
|
||
|
<Select
|
||
|
mode="multiple"
|
||
|
style={{ width: '100%' }}
|
||
|
placeholder="select one country"
|
||
|
defaultValue={['china']}
|
||
|
onChange={handleChange}
|
||
|
optionLabelProp="label"
|
||
|
>
|
||
|
<Option value="china" label="China">
|
||
|
<div className="demo-option-label-item">
|
||
|
<span role="img" aria-label="China">
|
||
|
🇨🇳
|
||
|
</span>
|
||
|
China (中国)
|
||
|
</div>
|
||
|
</Option>
|
||
|
<Option value="usa" label="USA">
|
||
|
<div className="demo-option-label-item">
|
||
|
<span role="img" aria-label="USA">
|
||
|
🇺🇸
|
||
|
</span>
|
||
|
USA (美国)
|
||
|
</div>
|
||
|
</Option>
|
||
|
<Option value="japan" label="Japan">
|
||
|
<div className="demo-option-label-item">
|
||
|
<span role="img" aria-label="Japan">
|
||
|
🇯🇵
|
||
|
</span>
|
||
|
Japan (日本)
|
||
|
</div>
|
||
|
</Option>
|
||
|
<Option value="korea" label="Korea">
|
||
|
<div className="demo-option-label-item">
|
||
|
<span role="img" aria-label="Korea">
|
||
|
🇰🇷
|
||
|
</span>
|
||
|
Korea (韩国)
|
||
|
</div>
|
||
|
</Option>
|
||
|
</Select>
|
||
|
);
|
||
|
|
||
|
export default App;
|