Security News
Fluent Assertions Faces Backlash After Abandoning Open Source Licensing
Fluent Assertions is facing backlash after dropping the Apache license for a commercial model, leaving users blindsided and questioning contributor rights.
react-hook-form-mui
Advanced tools
This project simplifies the use of react-hook-form
and Material-UI
. It provides opinionated use cases with following
components:
Please check out the demo for the element overview.
# npm install react-hook-form react-hook-form-mui
# yarn add react-hook-form react-hook-form-mui
This package utilizes pickers and icons of the MUI ecosystem. If you make use of it add them to your app.
# npm install @mui/x-date-pickers @mui/icons-material
# yarn add @mui/x-date-pickers @mui/icons-material
From versions >= 3.x of this package MUI v5 is in use. Versions of 1 & 2 using Material-UI v4
import {FormContainer, TextFieldElement} from 'react-hook-form-mui'
function Form() {
return (
<FormContainer
defaultValues={{name: ''}}
onSuccess={data => console.log(data)}
>
<TextFieldElement name="name" label="Name" required/>
</FormContainer>
)
}
You can have a look at the example
folder which sets up NextJS with react-hook-form-mui
formContext
The <FormContainer />
wires up a form and you can create sub-components which either make use
of useFormContext() | useWatch()
to react to form values.
Check out Storybook: Demo
You will find examples and use cases.
If you are using the DatepickerElement
keep in mind that you have to wrap your form with a provider:
Examples for Dayjs or DateFns provider (used in the demo):
For convenient reasons this package is re-exporting react-hook-form
which is especially required if you have context
issues of React.
import {useWatch} from 'react-hook-form-mui' // instead of react-hook-form
const MySubmit = () => {
const value = useWatch('fieldName')
return (
<Button disabled={!value}>Submit</Button>
)
}
This project uses tsup
to wrap the package for npm
.
FAQs
Unknown package
The npm package react-hook-form-mui receives a total of 31,919 weekly downloads. As such, react-hook-form-mui popularity was classified as popular.
We found that react-hook-form-mui demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 0 open source maintainers collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
Fluent Assertions is facing backlash after dropping the Apache license for a commercial model, leaving users blindsided and questioning contributor rights.
Research
Security News
Socket researchers uncover the risks of a malicious Python package targeting Discord developers.
Security News
The UK is proposing a bold ban on ransomware payments by public entities to disrupt cybercrime, protect critical services, and lead global cybersecurity efforts.