react-hook-form-material-ui
v2.1.1
Published
This package is a simple bridge between react-hook-form and material-ui.
Downloads
4
Readme
react-hook-form-material-ui
This package is a simple bridge between react-hook-form and material-ui
| DOC | | -------------- |
Install
npm install react-hook-form-material-ui
# or
yarn add react-hook-form-material-ui
Usage
import React from 'react'
import Button from '@mui/material/Button'
import { Form, TextField } from 'react-hook-form-material-ui'
import { FormControl } from "@mui/material";
const App = () => {
const handleSubmit = (data) => {
console.info("Data submitted:")
console.info(data)
}
return <>
<Form
parameters={{
defaultValues: {
textField: 'My TextField'
}
}}
onSubmit={handleSubmit}
>
<TextField
name="textField"
textFieldProps={{ label: "TextField" }}
/>
<FormControl>
<Button type="submit" variant="contained">Submit</Button>
</FormControl>
</Form>
</>
}
License
This is completely free and released under the MIT License.