# material-ui-formik-components

> We all love [Material-UI](https://material-ui.com) and [Formik](https://formik.org), we just need an easy way to make them work seamlessly together. This library was built just for that.

Latest version **0.7.3** (published 2020-10-22) · MIT license · 0 weekly downloads

> **Deprecated.** This package is deprecated.

## Install

```sh
npm install material-ui-formik-components
pnpm add material-ui-formik-components
yarn add material-ui-formik-components
bun add material-ui-formik-components
```

## Health

**Score 10/100 (F)** — status: deprecated.

Negative: deprecated.

## Facts

| | |
|---|---|
| Version | 0.7.3 |
| Published | 2020-10-22 |
| First published | 2018-09-19 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | bundled |
| Module format | ESM + CommonJS |
| Dependencies | 4 |
| Unpacked size | 100.6 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 84 |
| Author | Gerasimos Chatzidamianos |
| Maintainers | gerhat |
| Keywords | react, formik, material-ui, form component, form, autocomplete, material-ui-pickers, material-ui-chip-input |

## Links

- npm: https://www.npmjs.com/package/material-ui-formik-components
- Repository: https://github.com/gerhat/material-ui-formik-components
- Homepage: https://github.com/gerhat/material-ui-formik-components#readme
- Issues: https://github.com/gerhat/material-ui-formik-components/issues
- npm.io page: https://npm.io/package/material-ui-formik-components

## Dependencies (4)

- [date-fns](https://npm.io/package/date-fns.md) >=2
- [@date-io/date-fns](https://npm.io/package/@date-io/date-fns.md) >= 1 <2
- [@material-ui/pickers](https://npm.io/package/@material-ui/pickers.md) >=3
- [material-ui-chip-input](https://npm.io/package/material-ui-chip-input.md) >=1

## Alternatives

- [mobx-react](https://npm.io/package/mobx-react.md) — 2.8M weekly downloads
- [rc-tree](https://npm.io/package/rc-tree.md) — 2.6M weekly downloads
- [@react-oauth/google](https://npm.io/package/@react-oauth/google.md) — 1.3M weekly downloads
- [@wagmi/connectors](https://npm.io/package/@wagmi/connectors.md) — 877.0K weekly downloads
- [vee-validate](https://npm.io/package/vee-validate.md) — 836.4K weekly downloads

## Recent versions

- 0.7.3 (latest) — 2020-10-22
- 0.7.2 — 2020-09-05
- 0.7.1 — 2020-05-12
- 0.7.0 — 2020-05-02
- 0.6.3 — 2020-05-02
- 0.6.2 — 2020-04-23
- 0.6.1 — 2020-03-29
- 0.6.0 — 2020-03-08
- 0.5.2 — 2019-11-24
- 0.5.1 — 2019-11-09
- 0.5.0 — 2019-11-09
- 0.4.1 — 2019-09-16
- 0.4.0 — 2019-06-02
- 0.3.0 — 2019-04-26
- 0.2.4 — 2019-04-06
- … 10 more at https://npm.io/package/material-ui-formik-components/versions

## README

# Material-UI Formik Components <br/> [![NPM](https://img.shields.io/npm/v/material-ui-formik-components?color=%23177bbb)](https://www.npmjs.com/package/material-ui-formik-components) &middot; [![Total Downloads](https://img.shields.io/npm/dm/material-ui-formik-components?style=flat)](https://www.npmjs.com/package/material-ui-formik-components) &middot; [![devDependency Status](https://david-dm.org/gerhat/material-ui-formik-components/dev-status.svg)](https://david-dm.org/gerhat/material-ui-formik-components?type=dev) &middot; [![npm bundle size](https://img.shields.io/bundlephobia/minzip/material-ui-formik-components)](https://www.npmjs.com/package/material-ui-formik-components)
We all love [Material-UI](https://material-ui.com) and [Formik](https://formik.org), we just need an easy way to make them work seamlessly together. This library was built just for that.

# Installation
Install the `material-ui-formik-components` package using the following command:

```sh
$ npm install --save material-ui-formik-components
```

## Peer dependencies
The extension depends on the following packages:

**Required**
- [react](https://www.npmjs.com/package/react) >= 16.8
- [react-dom](https://www.npmjs.com/package/react-dom) >= 16.8
- [Material-UI](https://material-ui.com) >= 4.0
- [Formik](https://formik.org) >= 2.0

**Optional**
- [Material-UI Lab](https://material-ui.com/components/about-the-lab/) >4.0 - used by `Autocomplete`
- [Material-UI Pickers](https://material-ui-pickers.dev/) >= 3.0 - used by `DatePicker`, `DateTimePicker`, `KeyboardDatePicker`, `KeyboardTimePicker`, `KeyboardDateTimePicker` and `TimePicker`
- [material-ui-chip-input](https://github.com/TeamWertarbyte/material-ui-chip-input) >= 1.0 - used by `ChipInput`

# Using the components
The following components are supported:

- `Autocomplete` - requires [Material-UI Lab](https://material-ui.com/components/about-the-lab/)
- `ChipInput` - requires [material-ui-chip-input](https://github.com/TeamWertarbyte/material-ui-chip-input)
- `DatePicker`, `DateTimePicker`, `KeyboardDatePicker`, `KeyboardTimePicker`, `KeyboardDateTimePicker` and `TimePicker` - please make sure you have installed `date-fns`, `moment` or `luxon` see: [Material-UI Pickers / Installation](https://material-ui-pickers.dev/getting-started/installation)
- `RadioGroup`
- `Select`
- `Switch`
- `TextField`

Below is an example of `TextField` and `Select` components. Code sandbox url: https://codesandbox.io/s/xoplpm1w84

```jsx
import React from 'react'
import { Formik, Form, Field } from 'formik'
import { TextField } from 'material-ui-formik-components/TextField'
import { Select } from 'material-ui-formik-components/Select'

class RegistrationForm extends React.PureComponent {
  render() {
    return (
      <div>
        <h1>Register</h1>
        <Formik
          initialValues={{
            username: '',
            gender: 'Male',
          }}
          onSubmit={values => {
            alert(`Username: ${values.username}\nGender: ${values.gender}`)
          }}
        >
          {formik => (
            <Form>
              <Field name="username" label="Username" component={TextField} />
              <Field
                required
                name="gender"
                label="Gender"
                options={[
                  { value: 'Male', label: 'Male' },
                  { value: 'Female', label: 'Female' },
                  { value: 'Other', label: 'Other' },
                ]}
                component={Select}
              />
              <button type="submit" disabled={!formik.dirty}>
                Submit
              </button>
            </Form>
          )}
        </Formik>
      </div>
    )
  }
}

export default RegistrationForm
```

# Example
For a more detailed use of the package, please refer to the code in the [example folder](https://github.com/gerhat/material-ui-formik-components/tree/master/example) of this project.

# License
MIT

---
_Source: https://npm.io/package/material-ui-formik-components · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
