mirror of
https://github.com/ant-design/ant-design.git
synced 2024-12-15 00:29:12 +08:00
57521a01e9
* feat: Select support maxCount prop
* fix: fix snap
* chore: fix
* fix: fix
* fix: fix
* rename: .tsx => .ts
* docs: update docs
* Update components/select/demo/maxCount.md
Co-authored-by: MadCcc <madccc@foxmail.com>
Signed-off-by: lijianan <574980606@qq.com>
* Revert "rename: .tsx => .ts"
This reverts commit c9c5f5acbe
.
* fix: update rc-select
* Update components/select/demo/maxCount.md
Co-authored-by: MadCcc <madccc@foxmail.com>
Signed-off-by: lijianan <574980606@qq.com>
* Update components/select/index.tsx
Co-authored-by: MadCcc <madccc@foxmail.com>
Signed-off-by: lijianan <574980606@qq.com>
* update demo
---------
Signed-off-by: lijianan <574980606@qq.com>
Co-authored-by: MadCcc <madccc@foxmail.com>
44 lines
1.1 KiB
TypeScript
44 lines
1.1 KiB
TypeScript
import React from 'react';
|
|
import { DownOutlined } from '@ant-design/icons';
|
|
import { Select } from 'antd';
|
|
|
|
const MAX_COUNT = 3;
|
|
|
|
const App: React.FC = () => {
|
|
const [value, setValue] = React.useState<string[]>(['Ava Swift']);
|
|
|
|
const suffix = (
|
|
<>
|
|
<span>
|
|
{value.length} / {MAX_COUNT}
|
|
</span>
|
|
<DownOutlined />
|
|
</>
|
|
);
|
|
|
|
return (
|
|
<Select
|
|
mode="multiple"
|
|
maxCount={MAX_COUNT}
|
|
value={value}
|
|
style={{ width: '100%' }}
|
|
onChange={setValue}
|
|
suffixIcon={suffix}
|
|
placeholder="Please select"
|
|
options={[
|
|
{ value: 'Ava Swift', label: 'Ava Swift' },
|
|
{ value: 'Cole Reed', label: 'Cole Reed' },
|
|
{ value: 'Mia Blake', label: 'Mia Blake' },
|
|
{ value: 'Jake Stone', label: 'Jake Stone' },
|
|
{ value: 'Lily Lane', label: 'Lily Lane' },
|
|
{ value: 'Ryan Chase', label: 'Ryan Chase' },
|
|
{ value: 'Zoe Fox', label: 'Zoe Fox' },
|
|
{ value: 'Alex Grey', label: 'Alex Grey' },
|
|
{ value: 'Elle Blair', label: 'Elle Blair' },
|
|
]}
|
|
/>
|
|
);
|
|
};
|
|
|
|
export default App;
|