GithubHelp home page GithubHelp logo

star2star / s2s-react-schema-form Goto Github PK

View Code? Open in Web Editor NEW

This project forked from jeanlescure/material-ui-schema-form

0.0 7.0 0.0 8.15 MB

react form based on json schema for form generation and validation

License: MIT License

JavaScript 89.58% HTML 0.31% CSS 10.11%

s2s-react-schema-form's Introduction

react-schema-form Demo

View live demo!

react-schema-form

This library is an ongoing re-write of Jeanlescure's material-ui-schema-form.

Why re-write?

Jeanlescure's material-ui-schema-form was the most current react json schma form library for our needs, but changes needed to be made to fit our needs. Since the library did not have the option to submit issues we decided to fork it and implement the changes ourselves. The original library had side effects resulting from the use of asynchronus setState. We have update all instances of setState to use react's best practices.

Installation

npm install s2s-react-schema-form --save

Usage

import { SchemaForm } from "s2s-react-schema-form";

<SchemaForm schema={this.state.schema} form={this.state.form} model={this.props.model} onModelChange={this.props.onModelChange} />

Form format

React-schema-form implements the form format as defined by the json-schema-form standard.

The documentation for that format is located at the json-schema-form wiki.

Customization

s2s-react-schema-form provides most fields including FieldSet and Array and they might cover most use cases; however, you might have requirement that needs something that is not built in. In this case, you can implement your own field and inject it into the generic mapper for the builder to leverage your component. By passing a mapper as a props to the SchemaForm, you can replace built in component with yours or you can define a brand new type and provide your component to render it.

react-schema-form-rc-select is an example to provide multiple select to the react schema form.

require('rc-select/assets/index.css');
import RcSelect from 'react-schema-form-rc-select/lib/RcSelect';
...

        var mapper = {
            "rc-select": RcSelect
        };

        var schemaForm = '';
        if (this.state.form.length > 0) {
            schemaForm = (
                <SchemaForm schema={this.state.schema} form={this.state.form} model={this.state.model} onModelChange={this.onModelChange} mapper={mapper} />
            );
        }

License

MIT Licensed.

s2s-react-schema-form's People

Contributors

agrishun avatar altheaschutte avatar cartor avatar curtiswilkinson avatar devel-pa avatar gitter-badger avatar gtaschuk avatar jeanlescure avatar jschimmoeller avatar maplechori avatar mikedizon avatar mrsaints avatar nicklasb avatar oceanic815recovery avatar psamim avatar ruifortes avatar stevehu avatar stropitek avatar vaevictus avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.