mirror of
https://github.com/ant-design/ant-design.git
synced 2024-12-15 08:59:15 +08:00
27 lines
631 B
TypeScript
27 lines
631 B
TypeScript
import React, { useState } from 'react';
|
|
import { Select } from 'antd';
|
|
|
|
const OPTIONS = ['Apples', 'Nails', 'Bananas', 'Helicopters'];
|
|
|
|
const App: React.FC = () => {
|
|
const [selectedItems, setSelectedItems] = useState<string[]>([]);
|
|
|
|
const filteredOptions = OPTIONS.filter((o) => !selectedItems.includes(o));
|
|
|
|
return (
|
|
<Select
|
|
mode="multiple"
|
|
placeholder="Inserted are removed"
|
|
value={selectedItems}
|
|
onChange={setSelectedItems}
|
|
style={{ width: '100%' }}
|
|
options={filteredOptions.map((item) => ({
|
|
value: item,
|
|
label: item,
|
|
}))}
|
|
/>
|
|
);
|
|
};
|
|
|
|
export default App;
|