Skip to content
This repository has been archived by the owner on Jan 23, 2023. It is now read-only.

projectstorm/react-forms

Repository files navigation

Note: use formik instead :)

STORM React Forms

DEMO: http://projectstorm.cloud/react-forms

A super simple, no-nonsense form library written in React that (hopefully) just works.

Join the chat at https://gitter.im/projectstorm/react-forms NPM NPM CircleCI

Demo1

Start Here

Forms in React can be quite difficult, but with this library, forms become quite easy. Storm React Forms (SRF) provides a simple way to create forms in a very declarative way.

Declare your form using standard react widgets, but make use of Storm Element Widgets when you want to actually use an input field. When you click submit on your form, the form will fire a formSubmitEvent(model) which will contain an object with all the values in your form.

Example

<FormWidget formSubmitEvent={ model => console.log(model) }>
	<TableLayoutWidget>
		<FieldElementWidget name="Name" />
		<FieldElementWidget name="Surname" />
	</TableLayoutWidget>
</FormWidget>

The model will contain {Name, Surname}

One-way binding

you can pass a value={object} onto a form and it will automatically populate your form fields with the values in the object. This does not change object when the form fires but instead will pass the new object as the first param in the formSubmitEvent(object) (like in the previous example)

Usage

Take a look at the demos URL as well as the demos folder (docs will follow soon)