Gathering detailed insights and metrics for mobx-react-form
Gathering detailed insights and metrics for mobx-react-form
Gathering detailed insights and metrics for mobx-react-form
Gathering detailed insights and metrics for mobx-react-form
mobx-react-form-devtools
DevTools for MobX React Form
mobx-react-hook-form
Simple [react-hook-form](https://react-hook-form.com/) wrapper for [MobX](https://mobx.js.org/).
reactive-mobx-form
Reactive forms for React running on MobX
@monoid-dev/mobx-zod-form-react
[](https://dl.circleci.com/status-badge/redirect/gh/MonoidDev/mobx-zod-form/tree/master) [
HTML (0.87%)
JavaScript (0.31%)
Total Downloads
0
Last Day
0
Last Week
0
Last Month
0
Last Year
0
MIT License
1,093 Stars
890 Commits
130 Forks
21 Watchers
10 Branches
32 Contributors
Updated on Jul 17, 2025
Latest Version
6.12.1
Package Id
mobx-react-form@6.12.1
Unpacked Size
1.21 MB
Size
234.83 kB
File Count
195
NPM Version
9.6.5
Node Version
20.19.0
Published on
May 05, 2025
Cumulative downloads
Total Downloads
Last Day
0%
NaN
Compared to previous day
Last Week
0%
NaN
Compared to previous week
Last Month
0%
NaN
Compared to previous month
Last Year
0%
NaN
Compared to previous year
1
1
34
1npm install --save mobx-react-form
Below we are creating a plugins
object using the validatorjs
package to enable DVR
functionalities (Declarative Validation Rules).
1import dvr from 'mobx-react-form/lib/validators/DVR'; 2import validatorjs from 'validatorjs'; 3 4const plugins = { 5 dvr: dvr({ 6 package: validatorjs 7 }) 8};
See Validation Plugins for more info on supported packages.
Define the fields
as a collection with a rules
property for the validation.
1const fields = [{ 2 name: 'email', 3 label: 'Email', 4 placeholder: 'Insert Email', 5 rules: 'required|email|string|between:5,25', 6}, { 7 name: 'password', 8 label: 'Password', 9 placeholder: 'Insert Password', 10 rules: 'required|string|between:5,25', 11 type: 'password', 12}, { 13 name: 'passwordConfirm', 14 label: 'Password Confirmation', 15 placeholder: 'Confirm Password', 16 rules: 'required|string|same:password', 17 type: 'password', 18}];
See Fields Definitions and all available Field Props on the docs.
1const hooks = { 2 onSuccess(form) { 3 alert('Form is valid! Send the request here.'); 4 // get field values 5 console.log('Form Values!', form.values()); 6 }, 7 onError(form) { 8 alert('Form has errors!'); 9 // get all form errors 10 console.log('All form errors', form.errors()); 11 } 12}
See more on the docs about the Validation Hooks and the Event Hooks
Simply pass the fields
, plugins
and hooks
objects to the constructor
1import MobxReactForm from 'mobx-react-form'; 2 3const myForm = new MobxReactForm({ fields }, { plugins, hooks });
Learn more on the docs about the Form Instance and the Form Options
The package provide some built-in and ready to use Event Handlers:
onSubmit(e)
, onClear(e)
, onReset(e)
& more...
1import React from 'react'; 2import { observer } from 'mobx-react'; 3 4export default observer(({ myForm }) => ( 5 <form onSubmit={myForm.onSubmit}> 6 <label htmlFor={myForm.$('email').id}> 7 {myForm.$('email').label} 8 </label> 9 <input {...myForm.$('email').bind()} /> 10 <p>{myForm.$('email').error}</p> 11 12 {/* ... other inputs ... */} 13 14 <button type="submit" onClick={myForm.onSubmit}>Submit</button> 15 <button type="button" onClick={myForm.onClear}>Clear</button> 16 <button type="button" onClick={myForm.onReset}>Reset</button> 17 18 <p>{myForm.error}</p> 19 </form> 20));
See more on the docs about the Field Props Bindings
See how to implement the same configuration of this quickstart extending the Form class
npm run test
npm run build
npm run commit
When opening new issues, provide the setup of your form in a CodeSandbox.
These issues, and the ones which provides also PR with failing tests will get higher priority.
This project exists thanks to all the people who contribute.
Thank you to all our backers! 🙏 [Become a backer]
Support this project by becoming a sponsor. Your logo will show up here with a link to your website. [Become a sponsor]
No vulnerabilities found.
Reason
no dangerous workflow patterns detected
Reason
no binaries found in the repo
Reason
license file detected
Details
Reason
2 commit(s) and 0 issue activity found in the last 90 days -- score normalized to 1
Reason
Found 2/28 approved changesets -- score normalized to 0
Reason
dependency not pinned by hash detected -- score normalized to 0
Details
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
project is not fuzzed
Details
Reason
branch protection not enabled on development/release branches
Details
Reason
SAST tool is not run on all commits -- score normalized to 0
Details
Reason
18 existing vulnerabilities detected
Details
Score
Last Scanned on 2025-07-14
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