ant-design/components/input/demo/textarea-show-count.md
kiner-tang(文辉) 6d253369d4
fix: when we apply style resize: none, TextArea should be not resizable when showCount is applied (#37855)
Co-authored-by: tangwenhui <tangwenhui@rd.netease.com>
2022-10-06 19:19:16 +08:00

761 B

order title
12
zh-CN en-US
带字数提示的文本域 Textarea with character counting

zh-CN

展示字数提示。

en-US

Show character counting.

import { Input } from 'antd';
import React from 'react';

const { TextArea } = Input;

const onChange = (e: React.ChangeEvent<HTMLTextAreaElement>) => {
  console.log('Change:', e.target.value);
};

const App: React.FC = () => (
  <>
    <TextArea
      showCount
      maxLength={100}
      style={{ height: 120 }}
      onChange={onChange}
      placeholder="can resize"
    />
    <TextArea
      showCount
      maxLength={100}
      style={{ height: 120, resize: 'none' }}
      onChange={onChange}
      placeholder="disable resize"
    />
  </>
);

export default App;