Skip to content

gardun0/formland-material-ui

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

37 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

formland-material-ui Build Status

This is a collection of Material UI input components for Formland

Formland Material

Table of Contents

Get started

Installation

npm i formland formland-material-ui

or

yarn add formland formland-material-ui

Example

import React, { Component } from 'react'
import { componentResolver, valueResolver } from 'formland-material-ui' // Yay!
import Form from 'formland'

class Example extends Component {
  state = {}

  onChange = (newState) => {
    this.setState(newState)
  }

  render() {
    const config = [
      {
        id: 'firstName',
        type: 'material-text', // this is where we defined out custom Material UI field
        resultPath: 'country',
        displayName: 'Shipping Country',
        placeholder: 'Select a country',
        options: [
          {
            value: 'india',
            label: 'India',
          },
          {
            value: 'usa',
            label: 'The United States',
          },
          {
            value: 'china',
            label: 'China',
          }
        ],
      },
    ]

    // Right here we use the custom component and value resolver from this library
    return <Form
      customComponentResolvers={[componentResolver]}
      customValueResolvers={[valueResolver]}
      config={config}
      store={this.state}
      onChange={this.onChange} />
  }
}

API

componentResolver

Component resolver for Formland prop customComponentResolvers

Parameters

Returns JSX.Element

valueResolver

Value resolver for Formland prop customValueResolvers

Parameters

Returns Function

Fields

components

Available fields types

Properties

About

Formland component with Material UI

Resources

License

Stars

Watchers

Forks

Packages

No packages published