https://github.com/guilhermeuptotask/react-typescript-form-validation
https://github.com/guilhermeuptotask/react-typescript-form-validation
Last synced: 6 months ago
JSON representation
- Host: GitHub
- URL: https://github.com/guilhermeuptotask/react-typescript-form-validation
- Owner: guilhermeUpToTask
- Created: 2023-05-09T13:00:51.000Z (almost 3 years ago)
- Default Branch: main
- Last Pushed: 2023-05-11T12:24:23.000Z (almost 3 years ago)
- Last Synced: 2025-07-03T14:56:23.194Z (9 months ago)
- Language: TypeScript
- Size: 72.3 KB
- Stars: 1
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# React TypeScript Form Validation System
This project is a validation system for forms written in React TypeScript. It covers almost all input types, including text, email, checkbox, time, date, number, password, file, and search. Additionally, it includes a radio group component. However, select and textarea inputs are still not supported.
## Installation
To use this project, you'll need to have Node.js installed. Once you have Node.js installed, you can run the following command to install the project's dependencies:
```
npm install up-to-task-validation-form
```
## Usage
To use this project, you'll need to import the components. Here's an example of how to use the Form component with some Input components and a RadioGroup component:
```
import { Input, RadioGroup, Form} from 'up-to-task-validation-form';
/>
Male
Female
```
For proper functionality, please note that the Input and RadioGroup components should be wrapped inside the Form component.
To handle form submissions, you can define a function that will be called when the form is submitted:
```
function onFormSubmit (e:React.FormEvent) {
const formData = new FormData(e.currentTarget);
console.log(Object.fromEntries(formData));
}
```
Note that this function will only be called if all input validations have passed.
## Components
This project includes the following components:
* Form: a wrapper component for forms.
* Input: a component for text inputs, email inputs, checkboxes, dates, times, numbers, passwords, and files.
* RadioGroup: a component for radio group inputs.
## Contributions
Contributions are welcome! To contribute to this project, fork the repository and create a pull request.
## License
This project is licensed under the MIT License.