Formik Field - how to CSS format the inbuilt <input> component

Viewed 3439

New to Formik. I am trying to CSS format the field that will be emitted by Formik , but am coming up short. Is wrapping each Field with a the right approach? I was hoping to pass a style attribute to but it doesnt accept one.

1 Answers

You can pass className="your-class", and then style the class as needed.

<Field
  className="main"
  type="number"
  name="numberInput"
  ... other props here ...
/>

will give you:

<input name="numberInput" class="main" type="number">
Related