Sat Thiru
Sat Thiru

Reputation: 990

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

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.

Upvotes: 3

Views: 5603

Answers (1)

Travis Buckley
Travis Buckley

Reputation: 31

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">

Upvotes: 3

Related Questions