Security News
ESLint is Now Language-Agnostic: Linting JSON, Markdown, and Beyond
ESLint has added JSON and Markdown linting support with new officially-supported plugins, expanding its versatility beyond JavaScript.
formsy-mui
Advanced tools
A Formsy wrapper for Material-UI components
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.
import React from 'react';
import Formsy from 'formsy-react-2';
import FormsyText from 'formsy-mui/FormsyText';
import RaisedButton from 'material-ui/RaisedButton';
class MyForm extends React.Component {
state = {
formIsValid: false
}
enableSubmit = () => {
this.setState({formIsValid: true});
}
disableSubmit = () => {
this.setState({formIsValid: false});
}
submit (model) {
console.log(model);
// 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.
render () {
return (
<Formsy.Form
onValidSubmit={this.submit}
onValid={this.enableSubmit}
onInvalid={this.disableSubmit}>
<div>
<FormsyText
name='foo'
validations='isEmail'
validationError='This is not a valid email'
required />
</div>
<div>
<RaisedButton
type='submit'
label='Submit'
disabled={!this.state.formIsValid} />
</div>
</Formsy.Form>
);
}
}
export default MyForm;
FAQs
A Formsy wrapper for Material-UI components
We found that formsy-mui demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
ESLint has added JSON and Markdown linting support with new officially-supported plugins, expanding its versatility beyond JavaScript.
Security News
Members Hub is conducting large-scale campaigns to artificially boost Discord server metrics, undermining community trust and platform integrity.
Security News
NIST has failed to meet its self-imposed deadline of clearing the NVD's backlog by the end of the fiscal year. Meanwhile, CVE's awaiting analysis have increased by 33% since June.