Formsy MUI
A Formsy wrapper for Material-UI components
Installation
To get started with Formsy MUI, you can simply install it with npm:
npm i --save formsy-mui
or with yarn
yarn add formsy-mui
Formsy MUI is currently compatible with React 15.5x. For React 15.4.x and below it is recommended that you install formsy-material-ui and formsy-react instead.
Basic Usage
import React from 'react';import Formsy from 'formsy-react-2';import FormsyText from 'formsy-mui/FormsyText';import RaisedButton from 'material-ui/RaisedButton'; Component state = formIsValid: false { this; } { this; } { console; // model = { // foo: 'foo@foo.com', // bar: 10 // } } // This code results in a form with Material UI text field and a submit button // that will run the `submit` method when the submit button is clicked with a // valid email. The submit button is disabled as long as the foo input is empty // and the value is not an email. On validation error it will show the error message. { return <Formsy.Form = = => <div> <FormsyText ='foo' ='isEmail' ='This is not a valid email' /> </div> <div> <RaisedButton ='submit' ='Submit' = /> </div> </Formsy.Form> ; } ;