Skip to content

Allow manually setting validation state #50

@imoby

Description

@imoby

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions