React-metaform is a React library for dynamically generating forms based on metadata.
This is particularly useful for creating data-centric business applications in which the schema is flexible and needs
to be stored in the database. This is also useful in other scenarios in which the forms are dynamic and cannot be hard-coded.
This project is similar to Meteor Autoform.
Alpha version disclaimer
React-metaform is under active development. APIs will change and things may still not work as expected. If you find
any issue, please report it. I'll do my best to fix it.
These are the known issues scheduled for the 1.0.0 version.
You can check the online demo here.
react-metaform is only supports
npm. Bower supported is on the way.
npm install react-metaform
The main React component.
import MetaForm from 'react-metaform/lib/MetaForm';
MetaForm props are listed here.
Additionally, you need a
ComponentFactory is responsible for determining which React
component to use for a given field metadata.
React-metaform comes with 2
This a clean factory. In order to use it,
import it, register all your components and then pass it to the
prop of the
import ComponentFactory from 'react-metaform/lib/ComponentFactory';
This is a pre-populated factory, the same used in the demo.
In order to use it,
import it and just pass it to the
componentFactory prop of the
import DefaultComponentFactory from 'react-metaform/lib/DefaultComponentFactory';
import rmf from 'react-metaform'; // now these are available: // rmf.MetaForm // rmf.ComponentFactory // rmf.DefaultComponentFactory
Building and running the demo locally
This should work in every environment, except that environment variables are being set in the
npm scripts which
make them not platform-independent. This should be fixed for the 1.0.0 release.
If you're on Linux or OSX, please remove the environment
SETs from the package.json scripts before you proceed.
git clone https://github.com/gearz-lab/react-metaform.git cd react-metaform npm install
In order to run the demo, while this issue is not fixed, you need to run 2 npm commands:
npm run wpds npm run start-demo-dev
Now the demo should be available here: http://localhost:4000/react-metaform/demo.html.
In order to run the
npm run test // OR, to run in Chrome instead of PhantomJS npm run test-chrome
What has changed is stated here.
Pull-requests are really really welcome. If you don't know what to contribute with, please check the 1.0.0 issues.
I'll be more than glad to invite frequent contributors to join the organization. If you need help understanding the project, please post an issue and I'll do my best to reply and make sure you understand everything you need.
In order to make a pull request:
- Fork it.
- Create your feature-branch git checkout -b your-new-feature-branch
- Commit your change git commit -am 'Add new feature'
- Push to the branch git push origin your-new-feature-branch
- Create new Pull Request with master branch
React-metaform is MIT licensed.