mirror of
https://github.com/ant-design/ant-design.git
synced 2024-12-14 08:09:13 +08:00
44 lines
907 B
TypeScript
44 lines
907 B
TypeScript
|
import React, { useState } from 'react';
|
||
|
import type { SelectProps } from 'antd';
|
||
|
import { Select, Space } from 'antd';
|
||
|
|
||
|
interface ItemProps {
|
||
|
label: string;
|
||
|
value: string;
|
||
|
}
|
||
|
|
||
|
const options: ItemProps[] = [];
|
||
|
|
||
|
for (let i = 10; i < 36; i++) {
|
||
|
const value = i.toString(36) + i;
|
||
|
options.push({
|
||
|
label: `Long Label: ${value}`,
|
||
|
value,
|
||
|
});
|
||
|
}
|
||
|
|
||
|
const App: React.FC = () => {
|
||
|
const [value, setValue] = useState(['a10', 'c12', 'h17', 'j19', 'k20']);
|
||
|
|
||
|
const selectProps: SelectProps = {
|
||
|
mode: 'multiple',
|
||
|
style: { width: '100%' },
|
||
|
value,
|
||
|
options,
|
||
|
onChange: (newValue: string[]) => {
|
||
|
setValue(newValue);
|
||
|
},
|
||
|
placeholder: 'Select Item...',
|
||
|
maxTagCount: 'responsive',
|
||
|
};
|
||
|
|
||
|
return (
|
||
|
<Space direction="vertical" style={{ width: '100%' }}>
|
||
|
<Select {...selectProps} />
|
||
|
<Select {...selectProps} disabled />
|
||
|
</Space>
|
||
|
);
|
||
|
};
|
||
|
|
||
|
export default App;
|