This package is a simple bridge between react-hook-form and material-ui
DOC |
---|
npm install react-hook-form-material-ui
# or
yarn add react-hook-form-material-ui
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>
</>
}
This is completely free and released under the MIT License.