/react-property-editor

Primary LanguageJavaScriptMIT LicenseMIT

React property editor

It is based on react-json and offers some predefined editors.

Demo & Examples

Live demo

To build the examples locally, run:

npm install
gulp dev

Then open localhost:8000 in a browser.

Installation

The easiest way to use this component is to install it from NPM and include it in your own React build process (using Browserify, Webpack, etc).

You can also use the standalone build by including dist/react-pathjs-chart.js in your page. If you use this, make sure you have already included React, and it is available as a global variable.

npm install react-pathjs-chart --save

Usage

import PropertyEditor from 'react-property-editor';

var App = React.createClass({
    getInitialState(){
        return {
            value: {
                name: "amigo",
                color: '',
                html: '',
                code: '',
                chart: {
                    showLines: true,
                    axisX: {
                        showLines: true
                    },
                },
                array: [1, 2, 3]
            }
        }
    },
    logChange(value){
        console.log(value);
        this.setState({value:value});
        console.log(this.state.value);

    },
    render() {
        return (<div>
            <PropertyEditor value={ this.state.value }  onChange={ this.logChange } />
        </div>)
    }
});

Properties

  • value - value object - map the structure of your property grid to your object.
  • onChange(value) - when any property is changed the changed value object is passed as parameter

Notes

License

MIT. Copyright (c) 2015 Roman Samec