Skip to content

Commit

Permalink
demo: update demo
Browse files Browse the repository at this point in the history
  • Loading branch information
li-jia-nan committed Dec 27, 2023
1 parent 7074622 commit 76f7eac
Show file tree
Hide file tree
Showing 2 changed files with 44 additions and 0 deletions.
8 changes: 8 additions & 0 deletions docs/demo/multiple-with-maxCount.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
---
title: multiple-with-maxCount
nav:
title: Demo
path: /demo
---

<code src="../examples/multiple-with-maxCount.tsx"></code>
36 changes: 36 additions & 0 deletions docs/examples/multiple-with-maxCount.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
/* eslint-disable no-console */
import React from 'react';
import Select from 'rc-select';
import '../../assets/index.less';

const Test: React.FC = () => {
const [value, setValue] = React.useState<string[]>(['1']);

const onChange = (v: any) => {
setValue(v);
};

return (
<>
<h2>Multiple with maxCount</h2>
<Select
maxCount={4}
mode="multiple"
value={value}
animation="slide-up"
choiceTransitionName="rc-select-selection__choice-zoom"
style={{ width: 500 }}
optionFilterProp="children"
optionLabelProp="children"
placeholder="please select"
onChange={onChange}
options={Array.from({ length: 20 }, (_, i) => ({
label: <span>中文{i}</span>,
value: i.toString(),
}))}
/>
</>
);
};

export default Test;

0 comments on commit 76f7eac

Please sign in to comment.