1.0.14 • Published 6 years ago

react-live-form v1.0.14

Weekly downloads
1
License
ISC
Repository
github
Last release
6 years ago

react-live-form

Build Status Coverage Status

react-live-form is a library for building a live forms (forms with dynamic fields) based on React.

Demo | Source

Setup

  • Install with npm or yarn:
npm i react-live-form
# OR
yarn add react-live-form
  • Use in your project:
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 = () =>
  <LiveForm formConfig={formConfig} />;

Tips

  • Use demo pages to find all available components with examples.

License

This project is offered under MIT License.

1.0.14

6 years ago

1.0.13

6 years ago

1.0.12

6 years ago

1.0.11

6 years ago

1.0.10

6 years ago

1.0.9

6 years ago

1.0.8

6 years ago

1.0.7

7 years ago

1.0.6

7 years ago

1.0.5

7 years ago

1.0.4

7 years ago

1.0.3

7 years ago

1.0.2

7 years ago

1.0.1

7 years ago

1.0.0

7 years ago