Gathering detailed insights and metrics for simple-react-form
Gathering detailed insights and metrics for simple-react-form
Gathering detailed insights and metrics for simple-react-form
Gathering detailed insights and metrics for simple-react-form
react-jsonschema-form
A simple React component capable of building HTML forms out of a JSON schema.
@rjsf/core
A simple React component capable of building HTML forms out of a JSON schema.
react-form-simple
A form library for quickly controlling react form input
@webiny/form
A simple React library for working with forms.
npm install simple-react-form
Typescript
Module System
71.6
Supply Chain
98.9
Quality
85.8
Maintenance
100
Vulnerability
99.6
License
TypeScript (96.33%)
JavaScript (3.67%)
Total Downloads
0
Last Day
0
Last Week
0
Last Month
0
Last Year
0
MIT License
230 Stars
389 Commits
38 Forks
16 Watchers
8 Branches
11 Contributors
Updated on Jun 03, 2025
Latest Version
4.2.1
Package Id
simple-react-form@4.2.1
Unpacked Size
112.97 kB
Size
24.72 kB
File Count
96
Published on
Jun 10, 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
Simple React Form is the simplest way to handle forms in React. It helps you make reusable form components in React and React Native.
This is just a framework, you must create the form components or install a package with fields that you will use.
To use with React Native, see the dedicated section
Form
and Field
.See API.md for the complete API reference.
Install the base package
1npm install simple-react-form 2# or 3yarn add simple-react-form
1import React, { useState } from 'react' 2import { Form, Field } from 'simple-react-form' 3import DatePicker from './myFields/DatePicker' 4import Text from './myFields/Text' 5 6function PostsCreate() { 7 const [state, setState] = useState({}) 8 9 return ( 10 <div> 11 <Form state={state} onChange={setState}> 12 <Field fieldName="name" label="Name" type={Text} /> 13 <Field fieldName="date" label="A Date" type={DatePicker} /> 14 </Form> 15 <p>My name is {state.name}</p> 16 </div> 17 ) 18}
In this example, the current value of the form will be stored in a state variable using useState
.
1import React, { useState } from 'react' 2import { Form, Field } from 'simple-react-form' 3import DatePicker from './myFields/DatePicker' 4import Text from './myFields/Text' 5 6function PostsCreate() { 7 const [state, setState] = useState({}) 8 9 return ( 10 <div> 11 <Form state={state} onChange={setState}> 12 <Field fieldName="name" label="Name" type={Text} /> 13 <Field fieldName="date" label="A Date" type={DatePicker} /> 14 </Form> 15 <p>My name is {state.name}</p> 16 </div> 17 ) 18}
In this example, the current value of the form will be stored inside the Form component and passed in the onSubmit function. The difference on this is that the state
prop does not change over time.
1import React, { useRef } from 'react' 2import { Form, Field } from 'simple-react-form' 3import DatePicker from './myFields/DatePicker' 4import Text from './myFields/Text' 5 6function PostsCreate({ initialDoc }) { 7 const formRef = useRef() 8 9 const onSubmit = ({ name, date }) => { 10 // handle submit 11 } 12 13 return ( 14 <div> 15 <Form ref={formRef} state={initialDoc} onSubmit={onSubmit}> 16 <Field fieldName="name" label="Name" type={Text} /> 17 <Field fieldName="date" label="A Date" type={DatePicker} /> 18 </Form> 19 <button onClick={() => formRef.current.submit()}>Submit</button> 20 </div> 21 ) 22}
React Simple Form is built from the idea that you can create custom components easily.
Basically, a field type is a component that receives a value
prop and an onChange
handler. It must render the value and call onChange
with the new value whenever it changes.
1import UploadImage from '../components/my-fields/upload' 2 3<Field fieldName='picture' type={UploadImage} squareOnly={true}/>
You must create a React component.
1import React from 'react' 2 3function UploadImage({ value, onChange, label, errorMessage }) { 4 return ( 5 <div> 6 <p>{label}</p> 7 <div> 8 <img src={value} alt="preview" /> 9 </div> 10 <TextField 11 value={value} 12 hintText="Image Url" 13 onChange={event => onChange(event.target.value)} 14 /> 15 <p>{errorMessage}</p> 16 </div> 17 ) 18} 19 20export default UploadImage
You can view the full list of props here.
In React Native the API is the same, but wrap the form contents in a View
component.
Example:
1import React from 'react' 2import { View, TextInput } from 'react-native' 3 4function TextFieldComponent({ value, onChange }) { 5 return ( 6 <View> 7 <TextInput 8 style={{ height: 40, borderColor: 'gray', borderWidth: 1 }} 9 onChangeText={onChange} 10 value={value} 11 /> 12 </View> 13 ) 14} 15 16export default TextFieldComponent
Render the form inside the desired component
1import React, { useState } from 'react' 2import Text from '../components/my-fields/text' 3import { Form, Field } from 'simple-react-form' 4import { View } from 'react-native' 5 6function MyForm() { 7 const [state, setState] = useState({}) 8 9 return ( 10 <Form state={state} onChange={setState}> 11 <View> 12 <Field fieldName='email' type={Text}/> 13 <Field fieldName='password' type={Text}/> 14 </View> 15 </Form> 16 ) 17}
You should always render your fields inside a View when using react native.
If you need to access the current form value in child components, use the WithValue
component.
1import React from 'react' 2import { Form, Field, WithValue } from 'simple-react-form' 3import Text from './myFields/Text' 4 5function Example() { 6 return ( 7 <div> 8 <Form> 9 <WithValue> 10 {value => ( 11 <div> 12 <p>The name is {value.name}</p> 13 <Field fieldName="name" label="Name" type={Text} /> 14 </div> 15 )} 16 </WithValue> 17 </Form> 18 </div> 19 ) 20}
Clone the repository, install dependencies and run:
1yarn test
No vulnerabilities found.
Reason
no dangerous workflow patterns detected
Reason
13 commit(s) and 0 issue activity found in the last 90 days -- score normalized to 10
Reason
no binaries found in the repo
Reason
license file detected
Details
Reason
Found 0/26 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
10 existing vulnerabilities detected
Details
Score
Last Scanned on 2025-07-07
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