react-input-pin-code
react-input-pin-code copied to clipboard
Allow manually setting validation state
Is your feature request related to a problem? Please describe.
Currently the validate prop accepts string | string[] | RegExp
as options. However, we want to be able to manually set whether validation has failed or not.
For example: We want to take in the users pin code, on complete call an api to validate, and when the api responds back with failure we want to set the state of the input as being 'invalid' or 'failed'. So having a manual prop option to set the validation state would fix this.
Describe the solution you'd like
My proposal is that we introduce a new isValid
or isError
prop that is of boolean
and can be manually set by the consumer at any point. When this is set, it will override any validation in place and force the validation to be set to invalid (showing the red indicators)
Describe alternatives you've considered For now, my suggestion is what is mentioned above.
Additional context N/A