/react-expanding-textarea

React textarea component to automatically expand and contract your textareas.

Primary LanguageJavaScriptMIT LicenseMIT

react-expanding-textarea

React textarea component to automatically expand and contract your textareas.

You can view the demo here.

Installation

Install the package via NPM:

$ npm install --save react-expanding-textarea

Usage

Use this exactly like you would a normal <textarea>; the only difference is that it is doing some simple expanding work behind the scenes for you!

import Textarea from 'react-expanding-textarea'

function handleChange(e) {
  console.log('Changed value to: ', e.target.value)
}

const myComponent = () =>
  <Textarea
    rows="1"
    maxLength="3000"
    className="textarea"
    name="post[notes]"
    placeholder="Notes"
    onChange={ handleChange } />

Development

  1. Make your changes to src/ExpandingTextarea.js and/or example/src and/or example/sass
  2. Run make to build the JS output as well as the example code
  3. Run $ open example/index.html to view the output

Contribute

  1. Check out the issues
  2. Fork this repository
  3. Clone your fork
  4. Check out a feature branch ($ git checkout -b my-feature)
  5. Make your changes and push your branch to your GitHub repo
  6. Create a pull request from your branch to this repo's master
  7. When all is merged, pull down the upstream changes to your master
  8. Delete your feature branch