mirror of
https://gitee.com/ant-design/ant-design.git
synced 2024-12-15 17:31:25 +08:00
29 lines
730 B
TypeScript
29 lines
730 B
TypeScript
|
import React, { useState } from 'react';
|
||
|
import { Input } from 'antd';
|
||
|
|
||
|
const { TextArea } = Input;
|
||
|
|
||
|
const App: React.FC = () => {
|
||
|
const [value, setValue] = useState('');
|
||
|
|
||
|
return (
|
||
|
<>
|
||
|
<TextArea placeholder="Autosize height based on content lines" autoSize />
|
||
|
<div style={{ margin: '24px 0' }} />
|
||
|
<TextArea
|
||
|
placeholder="Autosize height with minimum and maximum number of lines"
|
||
|
autoSize={{ minRows: 2, maxRows: 6 }}
|
||
|
/>
|
||
|
<div style={{ margin: '24px 0' }} />
|
||
|
<TextArea
|
||
|
value={value}
|
||
|
onChange={e => setValue(e.target.value)}
|
||
|
placeholder="Controlled autosize"
|
||
|
autoSize={{ minRows: 3, maxRows: 5 }}
|
||
|
/>
|
||
|
</>
|
||
|
);
|
||
|
};
|
||
|
|
||
|
export default App;
|