formik-wizard icon indicating copy to clipboard operation
formik-wizard copied to clipboard

Can you also have example for radio buttons and checkbox?

Open gilbertlucas46 opened this issue 4 years ago • 1 comments

gilbertlucas46 avatar Oct 09 '20 13:10 gilbertlucas46

Hey @gilbertlucas46 - Here was my solution for adding checkboxes (or any other form components like radio buttons, select dropdowns etc.)

  • Download formik-mui from npm
  • import the Switch component and insert it into a formik <Field/> component like this:
import { Field } from 'formik';
import { Switch } from 'formik-mui';

<FormControlLabel
     control={
        <Field
            name="[your-form-field-name]"
            component={Switch}
            type="checkbox"
         />
      }
    label="Do you want to do this"/>

gabeamaleoni avatar Feb 24 '22 22:02 gabeamaleoni