Search code examples
cssreactjsstylesformik

Tag <ErrorMessage> Formik react Style


I would like to apply the style to Formik's tag for react. How can I do?

<ErrorMessage name="email"></ErrorMessage>

I try with component={Custom} but don't work.

I use Tailwindcss.

Thanks if you want to help me.


Solution

  • This method worked for me in react..

    <ErrorMessage name='email' render={msg => <div className="error">{msg}</div>}/>
    

    then, call that className in the CSS file

    .error{
      color: red;
    }