blob: 6695316d4d91f00382bfd788c26acc6042bc7b05 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
|
import React from 'react';
import TextareaAutosize from '../src/TextareaAutosize';
const Example = React.createClass({
propTypes: {},
getInitialState() {
return {
value: 'replace me with your component'
};
},
render() {
const textareaStyle = {
padding: '10px 8px',
border: '1px solid rgba(39,41,43,.15)',
borderRadius: 4,
fontSize: 15
};
return (
<div style={{fontFamily: 'sans-serif', margin: 15}}>
<h2>Empty</h2>
<TextareaAutosize style={textareaStyle} placeholder='try writing some lines'/>
<h2>Minimum Height</h2>
<TextareaAutosize rows='3' style={textareaStyle} placeholder='minimun height is 3 rows'/>
<h2>Prefilled</h2>
<TextareaAutosize style={textareaStyle} defaultValue={'this\nis\na\nlong\ninitial\ntext'}/>
<h2>{'You can compare with this normal react <textarea>'}</h2>
<textarea style={textareaStyle} defaultValue={'this\nis\na\nlong\ninitial\ntext'}/>
</div>
);
}
});
React.render(<Example />, document.getElementById('container'));
|