An open API service indexing awesome lists of open source software.

https://github.com/pavlyukvadim/react-live-form

Created with a purpose to take control of your dynamic forms by the library
https://github.com/pavlyukvadim/react-live-form

demo ecmascript form-builder javascript jest observable react react-form-builder

Last synced: 2 months ago
JSON representation

Created with a purpose to take control of your dynamic forms by the library

Awesome Lists containing this project

README

        

# react-live-form
[![Build Status](https://travis-ci.org/PavlyukVadim/app.github.io.svg?branch=source)](https://travis-ci.org/PavlyukVadim/dynamic-forms) [![Coverage Status](https://coveralls.io/repos/github/PavlyukVadim/dynamic-forms/badge.svg?branch=source)](https://coveralls.io/github/PavlyukVadim/dynamic-forms?branch=source)

`react-live-form` is a library for building a live forms (forms with dynamic fields) based on [React](https://facebook.github.io/react/).

#### [Demo](https://pavlyukvadim.github.io/react-live-form/) | [Source](https://github.com/PavlyukVadim/dynamic-forms)

## Setup

* Install with `npm` or `yarn`:
```sh
npm i react-live-form
# OR
yarn add react-live-form
```

* Use in your project:

```jsx
import React from 'react';
import LiveForm from 'react-live-form';

const formConfig = {
formName: 'firstForm',
fields: [
{
name: 'a',
fieldType: 'input',
props: {
title: 'field a',
},
state: {
value: {
defaultValue: 5,
},
},
},
{
name: 'b',
fieldType: 'input',
props: {
title: 'field b',
},
},
{
name: 'c',
fieldType: 'input',
props: {
title: 'field c',
},
state: {
value: {
defaultValue: 0,
valueExpr: 'a + b',
},
},
},
{
name: 'd',
fieldType: 'input',
props: {
title: 'field d',
},
state: {
value: {
defaultValue: 0,
valueExpr: 'c * 2',
},
display: {
defaultValue: false,
valueExpr: 'a > 10',
},
disabled: {
defaultValue: false,
valueExpr: 'a > 34',
},
},
},
]
};

const MyComponent = () =>
;
```

## Tips

* Use [demo pages](https://pavlyukvadim.github.io/react-live-form/) to find all available components with examples.

## License
This project is offered under [MIT License](https://github.com/PavlyukVadim/dynamic-forms/blob/master/LICENSE).