Gathering detailed insights and metrics for react-hook-form-mui
Gathering detailed insights and metrics for react-hook-form-mui
Gathering detailed insights and metrics for react-hook-form-mui
Gathering detailed insights and metrics for react-hook-form-mui
react-hook-form
Performant, flexible and extensible forms library for React Hooks
@hookform/resolvers
React Hook Form validation resolvers: Yup, Joi, Superstruct, Zod, Vest, Class Validator, io-ts, Nope, computed-types, TypeBox, arktype, Typanion, Effect-TS and VineJS
@rjsf/mui
Material UI 5 theme, fields and widgets for react-jsonschema-form
@mui/private-theming
Private - The React theme context to be shared between `@mui/styles` and `@mui/material`.
npm install react-hook-form-mui
MUI pickers version 6 and some more improvements
Published on 30 Mar 2023
Add readonly prop to DatePicker and DateTimePicker
Published on 18 Nov 2022
Add DateTimePicker
Published on 14 Nov 2022
Support small prop on MultiSelectElement
Published on 15 Sept 2022
New Component
Published on 30 Aug 2022
Restructure Repo as Monorepo and re-export react-hook-form API
Published on 29 Aug 2022
Module System
Min. Node Version
Typescript Support
Node Version
NPM Version
562 Stars
534 Commits
111 Forks
10 Watching
3 Branches
36 Contributors
Updated on 25 Nov 2024
Minified
Minified + Gzipped
JavaScript (98.39%)
TypeScript (1.31%)
HTML (0.3%)
CSS (0.01%)
Cumulative downloads
Total Downloads
Last day
-14.8%
4,613
Compared to previous day
Last week
-5.1%
25,092
Compared to previous week
Last month
5.6%
111,998
Compared to previous month
Last year
82.4%
1,102,942
Compared to previous year
5
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.
1# npm install react-hook-form react-hook-form-mui 2# 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.
1# npm install @mui/x-date-pickers @mui/icons-material 2# 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
From version >= 6 x-date-pickers version 6 is in use. Make sure you upgrade your dependencies.
1import {FormContainer, TextFieldElement} from 'react-hook-form-mui' 2 3function Form() { 4 return ( 5 <FormContainer 6 defaultValues={{name: ''}} 7 onSuccess={data => console.log(data)} 8 > 9 <TextFieldElement name="name" label="Name" required/> 10 </FormContainer> 11 ) 12}
1 function Form() { 2 const {control, handleSubmit} = useForm({ 3 defaultValues: { 4 name: '', 5 auto: '', 6 check: false 7 }, 8 }) 9 const options = [ 10 {id: 'one', label: 'One'}, 11 {id: 'two', label: 'Two'}, 12 {id: 'three', label: 'Three'}, 13 ] 14 return ( 15 <form onSubmit={handleSubmit((data) => console.log(data))} noValidate> 16 <Stack spacing={2}> 17 <TextFieldElement 18 name={'name'} 19 label={'Name'} 20 control={control} 21 required 22 fullWidth 23 /> 24 <AutocompleteElement 25 name={'auto'} 26 label={'Autocomplete'} 27 control={control} 28 options={options} 29 /> 30 <CheckboxElement name={'check'} label={'Check'} control={control} /> 31 <Button type={'submit'} color={'primary'}> 32 Submit 33 </Button> 34 </Stack> 35 </form> 36 ) 37 }
You can have a look at all different possibilities to use forms at following code examples
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.
1import {useWatch} from 'react-hook-form-mui' // instead of react-hook-form 2 3const MySubmit = () => { 4 const value = useWatch('fieldName') 5 return ( 6 <Button disabled={!value}>Submit</Button> 7 ) 8}
This project uses tsup
to wrap the package for npm
.
If you find this package useful consider a small contribution: Buy Me A Coffee
Make sure you're running Node.js 20
1git clone https://github.com/dohomi/react-hook-form-mui.git 2cd react-hook-form-mui
1yarn
1yarn build
1yarn sb-start
Changes to storybook stories can be made in apps/storybook/stories
. Changes to the library can be made in packages/rhf-mui
.
No vulnerabilities found.
Reason
30 commit(s) and 7 issue activity found in the last 90 days -- score normalized to 10
Reason
no dangerous workflow patterns detected
Reason
no binaries found in the repo
Reason
license file detected
Details
Reason
Found 6/14 approved changesets -- score normalized to 4
Reason
detected GitHub workflow tokens with excessive permissions
Details
Reason
no effort to earn an OpenSSF best practices badge detected
Reason
security policy file not detected
Details
Reason
dependency not pinned by hash detected -- score normalized to 0
Details
Reason
branch protection not enabled on development/release branches
Details
Reason
project is not fuzzed
Details
Reason
SAST tool is not run on all commits -- score normalized to 0
Details
Reason
11 existing vulnerabilities detected
Details
Score
Last Scanned on 2024-11-25
The Open Source Security Foundation is a cross-industry collaboration to improve the security of open source software (OSS). The Scorecard provides security health metrics for open source projects.
Learn More