by @juanzitelli
This repository contains a reusable React component designed to handle password requirements for various applications. The component allows developers to easily implement consistent password validation across multiple React frontend applications.
- Clone this repository.
- Install dependencies using
pnpm install
- Run
pnpm test
to verify everything's working as expected by expecting all the tests to pass. - Run
pnpm dev
to run the test app in development mode. It should be available reachable at localhost:3000 - Done! You can play around with the app by toggling the different requirements that are listed on the main screen.
- Extra: You can decide whether the validation event occurs when the user focuses outside the input or when the input changes
- Extra: You can show/hide the contents of the password input by clicking on the "eye" button next to the input. You can't "show" the password if it's length is 0.
validateOnBlur
set totrue
will validate the password when the user loses focus from the input element.validateOnBlur
set tofalse
will validate the password when the user changes the contents of the input.
- Each application may have different password requirements.
- Password requirements are provided as a list and can be customized.
- The component's styling should be consistent with the provided design but allows for customization.
- Integration with popular form management/validation libraries (formik, react-hook-form).
- Improved error messaging and feedback for users.