diff options
author | Francesco Cioria <firefelix@gmail.com> | 2017-04-20 15:32:21 +0200 |
---|---|---|
committer | Francesco Cioria <firefelix@gmail.com> | 2017-04-20 15:32:21 +0200 |
commit | f3f7f1f130652726706b539bbf07414c6c37fd3e (patch) | |
tree | a916c4f1f4221424523efdad4b5b7b744f17f397 | |
parent | 3ca80251803a2fc8fa4e1eededad8ca4fdd357fb (diff) | |
download | react-autosize-textarea-f3f7f1f130652726706b539bbf07414c6c37fd3e.zip react-autosize-textarea-f3f7f1f130652726706b539bbf07414c6c37fd3e.tar.gz react-autosize-textarea-f3f7f1f130652726706b539bbf07414c6c37fd3e.tar.bz2 |
Add Props chapter in README.md
-rw-r--r-- | README.md | 18 |
1 files changed, 16 insertions, 2 deletions
@@ -25,9 +25,23 @@ npm install --save react-autosize-textarea ## Usage -You can pass any prop you're allowed to use with the default React textarea (`valueLink` too). +`TextareaAutosize` is perfectly compatible with ReactJS default one, so to get started you can simply replace any `<textarea></textarea>` with `<TextareaAutosize></TextareaAutosize>`. It's that easy :) -You can also pass the optional callback **onResize** which will be triggered at any resize with the `autosize:resized` event object: +### Props +You can pass any prop you're allowed to use with the default React `textarea` (`valueLink` too). + +In addition to them, `TextareaAutosize` comes with some optional custom `props` to facilitate its usage: + +|Name|Type|Default|Description| +|----|----|-------|-----------| +| **onResize** | <code>Function</code> | | *optional*. Called whenever the textarea resizes | +| **rows** | <code>Number</code> | | *optional*. Minimum number of visible rows | +| **maxRows** | <code>Number</code> | | *optional*. Maximum number of visible rows | + + +#### `onResize` + +Sometimes you may need to react any time `TextareaAutosize` resizes itself. To do so, you should use the optional callback **onResize** which will be triggered at any resize with the `autosize:resized` event object: ```jsx function onResize(event) { |