42 lines
879 B
TypeScript
42 lines
879 B
TypeScript
import React from 'react';
|
|
import { Flex, Input, Typography } from 'antd';
|
|
|
|
const App: React.FC = () => (
|
|
<Flex vertical gap={16}>
|
|
<div>
|
|
<Typography.Title level={5}>Exceed Max</Typography.Title>
|
|
<Input
|
|
count={{
|
|
show: true,
|
|
max: 10,
|
|
}}
|
|
defaultValue="Hello, antd!"
|
|
/>
|
|
</div>
|
|
|
|
<div>
|
|
<Typography.Title level={5}>Emoji count as length 1</Typography.Title>
|
|
<Input
|
|
count={{
|
|
show: true,
|
|
}}
|
|
defaultValue="🔥🔥🔥"
|
|
/>
|
|
</div>
|
|
|
|
<div>
|
|
<Typography.Title level={5}>Not exceed max</Typography.Title>
|
|
<Input
|
|
count={{
|
|
show: true,
|
|
max: 6,
|
|
exceedFormatter: (txt, { max }) => runes(txt).slice(0, max).join(''),
|
|
}}
|
|
defaultValue="🔥 antd"
|
|
/>
|
|
</div>
|
|
</Flex>
|
|
);
|
|
|
|
export default App;
|