npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

react-awesome-form-validator

v1.5.0

Published

This is a very nice form with validations using ReactJs

Downloads

69

Readme

Damian Aruj · CircleCI Status Build Status npm version

React Awesome Form Validation

This library is a simple solution of a common issue with forms with custom validations using ReactJs. It lets you use a pre-defined Input or even create your custom one with all it needs to be part of the same form.

Examples

Simple Form: Code Here

  • run: npm run simple-form

Form with custom Input: Code Here, Custom Input

  • run: npm run form-with-custom-input

Form with reset and clear values: Code Here

  • run: npm run form-with-reset-and-clear-values

Then open a browser and type: http://localhost:3000

Form Props:

| Name | Type | Default | Description | Required | |:--------------:|:-----------:|:-------:|:-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------:|----------| | children | node/string | - | Form inputs or other html tags or strings | - | | className | string | '' | Form className | false | | resetForm | boolean | - | if true will reset the form of default values. In order to use this prop you need to add formWasReset too. | false | | formWasReset | function | - | Function to be called right after we reset the form. The idea of this prop is to change the 'resetForm' prop to false again. example: formWasReset={() => this.setState({ resetForm: false })} | false | | onSubmit | function | - | When the user clicks on the SubmitButton and all the validations pass, it will call this method and it will pass an object with all the form's inputs values. | true | | onReset | function | - | When the user clicks on the ResetButton and all the validations pass, it will call this method and it will reset the form values. | false | | disableInputs | boolean | - | If true it will disable all fields. This prop is very useful for when we call the onSubmit method. | false | | clearValuesOnReset | boolean | - | If True it will reset and clear all values | false | | serverErrors | object | - | Object to display errors from the server. example: serverErrors={{ email: 'This email exist, please use another one' }} | false |

Input Props:

| Name | Type | Default | Description | Required | |:----------------:|:--------:|:-------:|:---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------:|----------| | type | string | text | Input type | true | | name | string | - | Input name and ref | true | | placeHolder | string | - | Input PlaceHolder | false | | label | string | - | Label to be displayed within the input | false | | customLabel | node | - | Label to be displayed within the input | false | | startValidatingWhenIsPristine | boolean | false | if true the input will start validating immediately as you start typing | false | | className | string | '' | Input className | false | | fieldClassName | string | '' | Every Input comes wrapped with a div. This is the div className | false | | invalidClassName | string | '' | className for the input when does not pass its validations | false | | onChange | function | - | We store internally on this library every input value and when you click on the SubmitButton and you pass all the validations it will call the method provided on the SubmitButton and it will pass an object with all the input values. Let's say you need to do something with the input value before the user clicks on SubmitButton, then you can get the its value with this prop. | false | | onBlur | function | - | Same as onChange | false | | validate | function | - | You have to return an object with the following structure: { valid, errorMessage } where valid is a boolean and errorMessage is a string. | false | | serverValue | string | '' | Value coming from the server | false | | readOnly | bool | false | if true will set the input as read only | false |

SubmitButton Props:

| Name | Type | Default | Description | Required | |:--------------:|:-----------:|:-------:|:-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------:|----------| | children | node/string | - | Button text | true | | className | string | '' | Button className | false | | fieldClassName | string | '' | This Button comes wrapped with a div. This is the div className | false | | disabledUntilFormIsValidated | boolean | false | It will disable the button until all fields are valid | false |

CustomSubmitButton Props:

| Name | Type | Default | Description | Required | |:--------------:|:-----------:|:-------:|:-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------:|----------| | children | node/string | - | Submit Button | true |

ResetButton Props:

| Name | Type | Default | Description | Required | |:--------------:|:-----------:|:-------:|:-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------:|----------| | children | node/string | - | Button text | true | | className | string | '' | Button className | false | | fieldClassName | string | '' | This Button comes wrapped with a div. This is the div className | false | | clearValues | boolean | - | If True it will reset and clear all values | false |

CustomResetButton Props:

| Name | Type | Default | Description | Required | |:--------------:|:-----------:|:-------:|:-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------:|----------| | children | node/string | - | Reset Button | true | | clearValues | boolean | - | If True it will reset and clear all values | false |

Hope you enjoy it!