Unform: Customize Input on Validation Error

Created on 18 May 2019  路  5Comments  路  Source: unform/unform

What would you like to be added:
Input customization when validation fail.

Why is this needed:
Cause this give us possibility of adding a custom style to the input when it is not valid.
For example: Change input border-color to RED

feature request

Most helpful comment

I think this is a good idea. When I was creating the web app for the "unform challenge", I needed to style the error message with a red color. If we could pass something like a styleError object as a prop would be great.

All 5 comments

Hey, could I take this one or are your working on that? :smile:

I think this is a good idea. When I was creating the web app for the "unform challenge", I needed to style the error message with a red color. If we could pass something like a styleError object as a prop would be great.

I think is a basic feature to handle and customize erros. I'm creating a app right now and I don't know how to handle this one.

@gabrielbuzziv thanks for the suggestion!

I think that adding a has-error class on the field solves this, what do you think about it? This class would be added automatically by unform when there's an error on the field, then you can style it however you want to.

Could you send us a PR?

Now you can create your own custom input and change input classes or styled when error is present. Check the Simple input guide.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

SereiaMaster picture SereiaMaster  路  3Comments

fmontone picture fmontone  路  4Comments

PierreBosch picture PierreBosch  路  5Comments

pdlug picture pdlug  路  3Comments

diego3g picture diego3g  路  4Comments