react-editinplace

1.0.5 • Public • Published

react-editinplace

Simple React component for editing in place.

Installation

npm install react-editinplace --save-dev

Example

var React = require('react'),
    EditInPlace = require('react-editinplace'),

    YourPage = React.createClass({
        getInitialState() {
            return {};

        },


        // validate input text
        _validate(text) {
            if (text.length > 0) {
                return true;
            }

            return false;

        },

        // save text to model etc.
        _onChange(text) {

        },

        render() {

            return <div className="yourpage">
                <EditInPlace
                    text="Some text"
                    editType="dblClick"
                    className="editinplace"
                    maxLength={10}
                    validate={this._validate}
                    activeClassName="active"
                    onChange={this._onChange} />
            </div>;

        }
    });

module.exports = YourPage;

Package Sidebar

Install

npm i react-editinplace

Weekly Downloads

0

Version

1.0.5

License

MIT

Unpacked Size

8.41 kB

Total Files

5

Last publish

Collaborators

  • nezriffic