Home

Awesome

Material UI - Simple React Form

Simple React Form is a powerful framework that simplifies the use of forms in React and React Native. This is a set of components that use Material UI.

To use this fields, import the field and pass it as type to the Field component.

<Form state={this.state} onChange={changes => this.setState(changes)}>
  <Field fieldName='name' label='Name' type={Text}/>
  <Field fieldName='date' label='A Date' type={DatePicker}/>
</Form>

Components

List of the components

Checkbox

import Checkbox from 'simple-react-form-material-ui/lib/checkbox'

Type: Boolean

Date Picker

Renders the material-ui date picker

import DatePicker from 'simple-react-form-material-ui/lib/date-picker'

Type: Date

Multiple Checkbox

Select multiple items from a array

import MultipleCheckbox from 'simple-react-form-material-ui/lib/multiple-checkbox'

Type: [String|Number]

Props:

Radio

Select one item from a array

import Radio from 'simple-react-form-material-ui/lib/radio'

Type: String|Number

Props:

Select With Method

A text field that searchs items with meteor methods

import SelectWithMethod from 'simple-react-form-material-ui/lib/select-with-method'

Type: String|Number

Props:

Select

Select one item from a array in a select field

import Select from 'simple-react-form-material-ui/lib/select'

Type: String|Number

Props:

Tags

Create a array of Strings.

import Tags from 'simple-react-form-material-ui/lib/tags'

Type: [String]

Text

import Text from 'simple-react-form-material-ui/lib/text'

Type: String

Props:

Textarea

A String with multiple lunes

import Textarea from 'simple-react-form-material-ui/lib/textarea'

Type: String

Toggle

import Toggle from 'simple-react-form-material-ui/lib/toggle'

Type: Boolean

Object

import ObjectComponent from 'simple-react-form-material-ui/lib/object'

Type: Object

Usage:

<Form>
  <Field fieldName='myObject' type={ObjectComponent}>
    <Field fieldName='myField' type={Text}/>
    <Field fieldName='myField2' type={Text}/>
  </Field>
</Form>

Array

import ArrayComponent from 'simple-react-form-material-ui/lib/array'

Type: Array

Usage:

<Form>
  <Field fieldName='myArray' type={ArrayComponent}>
    <Field fieldName='myField' type={Text}/>
    <Field fieldName='myField2' type={Text}/>
  </Field>
</Form>