项目作者: vutran

项目描述 :
:art: Create beautiful forms with JSONSchema
高级语言: JavaScript
项目地址: git://github.com/vutran/react-jsonschema.git
创建时间: 2016-06-24T22:14:31Z
项目社区:https://github.com/vutran/react-jsonschema

开源协议:MIT License

下载


React JSONSchema

Build Status Coverage Status license

Create beautiful forms with JSONSchema
Inspired by react-jsonschema-form from Mozilla.

Installation

  1. $ npm install --save react-jsonschema

Usage

  1. import Form from 'react-jsonschema';
  2. const schema = {
  3. "title": "Basic Demo",
  4. "type": "object",
  5. "properties": {
  6. "firstName": {
  7. "type": "string",
  8. "title": "First Name",
  9. },
  10. "lastName": {
  11. "type": "string",
  12. "title": "Last Name",
  13. },
  14. "age": {
  15. "type": "integer",
  16. "title": "Age",
  17. "description": "Age in years",
  18. },
  19. },
  20. };
  21. const formData = {
  22. firstName: '',
  23. lastName: '',
  24. age: '',
  25. };
  26. ReactDOM.render(
  27. <Form
  28. schema={schema}
  29. formData={formData}
  30. onError={errors => {
  31. console.log(errors);
  32. }}
  33. onSubmit={data => {
  34. console.log(data);
  35. }}
  36. />,
  37. document.getElementById('app'),
  38. );

Contributing

  1. Clone the repository
  2. Install dependencies

    With npm:

    1. $ npm install

    With yarn:

    1. $ yarn
  3. Run tests: npm t

References

Support

Like what you see? Become a Patron and support me via a monthly donation.

License

MIT © Vu Tran