Package Exports
- redux-form-material-ui
- redux-form-material-ui/lib/Checkbox
- redux-form-material-ui/lib/TextField
- redux-form-material-ui/lib/mapError
This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (redux-form-material-ui) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.
Readme
redux-form-material-ui
redux-form-material-ui
is a set of
wrappers to facilitate the use of
material-ui
components with
redux-form
.
Live Demo 👀
Installation
Using npm:
$ npm install --save redux-form-material-ui
Available Components
Usage
Rather than import your component class from material-ui
, import it from redux-form-material-ui
and then pass the component class directly to the component
prop of Field
.
import { reduxForm, Field } from 'redux-form'
import MenuItem from 'material-ui/MenuItem'
import { RadioButton } from 'material-ui/RadioButton'
import {
Checkbox,
RadioButtonGroup,
SelectField,
TextField,
Toggle
} from 'redux-form-material-ui'
class MyForm extends Component {
render() {
return (
<form>
<Field name="username" component={TextField} hintText="Street"/>
<Field name="plan" component={SelectField} hintText="Select a plan">
<MenuItem value="monthly" primaryText="Monthly"/>
<MenuItem value="yearly" primaryText="Yearly"/>
<MenuItem value="lifetime" primaryText="Lifetime"/>
</Field>
<Field name="agreeToTerms" component={Checkbox} label="Agree to terms?"/>
<Field name="receiveEmails" component={Toggle} label="Please spam me!"/>
<Field name="bestFramework" component={RadioButtonGroup}>
<RadioButton value="react" label="React"/>
<RadioButton value="angular" label="Angular"/>
<RadioButton value="ember" label="Ember"/>
</Field>
</form>
)
}
}
// Decorate with redux-form
MyForm = reduxForm({
form: 'myForm'
})
export default MyForm