When validation fails, I want the error message and TextField to look this way:
Desired result image.
So far, using MUI, I’m getting close to the desired result. Here is where I’m at: My progress image, but I’m not sure how to show the red border only if there is validation error.
In addition to that, I feel like I’m doing a lot custom style to make this look that way.
sx={{
fontSize: 20,
color: 'black',
}}
Maybe I’m doing something wrong. So please let know how I can improve it.
Here is my code: https://codesandbox.io/s/naughty-pond-5fg5z9?file=/src/App.js
2
Answers
Another solution I found for this was:
In order to to show the red border only if there is validation error change this code:
To this:
Basically you should conditionally apply style which adds red border.