ant-design/components/input/demo/show-count.tsx
二货爱吃白萝卜 6af1d95cf4
feat: Input & TextArea support count ()
* docs: init

* chore: update example

* test: update test

* docs: update doc

* chore: fix lint

* chore: update limit
2023-10-10 16:22:23 +08:00

25 lines
628 B
TypeScript

import React from 'react';
import { Flex, Input } from 'antd';
const { TextArea } = Input;
const onChange = (e: React.ChangeEvent<HTMLInputElement | HTMLTextAreaElement>) => {
console.log('Change:', e.target.value);
};
const App: React.FC = () => (
<Flex vertical gap={32}>
<Input showCount maxLength={20} onChange={onChange} />
<TextArea showCount maxLength={100} onChange={onChange} placeholder="can resize" />
<TextArea
showCount
maxLength={100}
onChange={onChange}
placeholder="disable resize"
style={{ height: 120, resize: 'none' }}
/>
</Flex>
);
export default App;