Home > database >  How to change formik <Field/> component's placeholder?
How to change formik <Field/> component's placeholder?

Time:03-22

Basically I'm not able to make date input empty with Formik. I just want it to show nothing initially. This is what I've been dealing for hours.

 <Field
 name="date"
 type="date"
   className={`InformationForm__field text-[20px] lg:h-14 px-4 lg:py-4 py-3  outline- none 
                                           `}
                                            />

note: I've tried placeholder, giving empty string as initial value etc.

Anyone have idea?

CodePudding user response:

You can try this

 <Field
  name="date"
  type="date"
  placeholder=""
  className={`InformationForm__field text-[20px] lg:h-14 px-4 lg:py-4 py-3  outline- none`}
 />

Check this: Formik docs

CodePudding user response:

Yo can try below code

     <Field
       name="lastName"
       render={({ field, form: { isSubmitting } }) => (
           <input {...field} disabled={isSubmitting} type="text" 
            placeholder="lastName" />
       )}
     />

Check this link for more info:- https://formik.org/docs/api/field#render

  • Related