React Form Package
Edit page
IntroductionInstallationFormSimple FormBasic UsageButtonFieldFieldWrapperRadioGroupSelectForm ValidationStateonFocus onChange onBlurState ManipulationCustom Error MessagesFeedback on disabled ButtonStylingDynamic FieldsDynamic Fields 2Dynamic Fields 3Bind Input FieldsBind Input Fields 2Third Party ComponentsFile UploadWhy

Simple Form

There are five (six) different components within this package. The <FieldWrapper /> component is only here for edge cases, e.g. working with third party components. So for this simple example we stick to these five:

import {
Button,
Field,
Form,
RadioGroup,
Select,
} from 'react-form-package';

If you are familiar with writing HTML forms than you are all set up. There are no complex data props or functions that you have to call before you can set up a form and validate its input like in most other libraries. Why should you care about writing the validations for your form yourself? An email, a date, a url, and so on, will always have the same structure. react-form-package will not only help you by your forms state management, it also will help you validating your forms correctly.

Basic Usage

  • Every <Button>, <Field>, <RadioGroup>, and <Select> component must have an id property and a type property
  • <Select> components have <option> childs which must have a value property
  • <RadioGroup> components have <input> childs which must have an id property, type property, and name property
  • If you want the form to valitate inputs and show error messages simply add a validate prop on the <Form> component

In this example we use all components and types this library supports:

checkbox
textarea
date
datetime-local
email
number
tel
text
password
time
url
select
radio