DEV Community

Discussion on: React Form using Formik, Material-UI and Yup.

Collapse
 
crazedvic profile image
Victor R.

Good Article. If Yup.required() is configured for a textfield, meaning it is a required field. How would you pass that information to the TextField so that is renders the label with the * suffix, either ideally before even touching the field but if that's impossible then at the very least after touching? Look here to see what the required field is supposed to look like material-ui.com/demos/text-fields/

Collapse
 
finallynero profile image
Nero Adaware

Thanks. I have not been able to figure out how to do this yet, I will keep looking for solutions. if you find a solution please share.

Collapse
 
faenor profile image
faenor • Edited

As you know beforehand which fields will be required, you can just use the "required" prop on the according TextField.