redux-form-material-ui
redux-form-material-ui-mad
is a fork of
from the library redux-form-material-ui
material-ui
components with
redux-form
.
Installation
Using npm:
$ npm install --save redux-form-material-ui-mad
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
.
{ 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-formMyForm = MyForm
Instance API
getRenderedComponent()
Returns a reference to the Material UI component that has been rendered. This is useful for
calling instance methods on the Material UI components. For example, if you wanted to focus on
the username
element when your form mounts, you could do:
{ thisrefsfirstField // the Field // on Field, returns ReduxFormMaterialUITextField // on ReduxFormMaterialUITextField, returns TextField // on TextField}
as long as you specified a ref
and withRef
on your Field
component.
{ return <form> ... <Field name="username" component=TextField withRef ref="firstField"/> ... </form> }