The documentation for HTML Metronic 8 shows a Stepper for forms, but I can't seem to use that Stepper in the React version. I assume there is a component for the Stepper in the React version, but I cannot see that in the documentation. How do I use the HTML Stepper or a Stepper component in the React version?
Hi,
We have examples of StepperComponent usage in react version on Horizontal Wizard page and Vertical Wizard page.
src/_metronic/assets/ts/components/_StepperComponent.ts is our typescript version of stepper.js from HTML version, so methods, events, and markup references are the same as in our HTML version. You can refer to HTML version's stepper doc page.
https://preview.keenthemes.com/html/metronic/docs/general/stepper
Regards,
Lauris Stepanovs,
Keenthemes Support Team
How should I import the StepperComponent? Is it imported as a script or as a React component? I tried copying the HTML version's sample code and it wasn't working. What functions do I import?
Thank you for your assistance
Hi,
You can import StepperComponent from src/_metronic/assets/ts/components/_StepperComponent.ts, it is a typescript file.
import {StepperComponent} from "../../../assets/ts/components"
Thank you for your reply, it was helpful. However I noticed that form handling was done in two ways across both the CreateAppModal and the Vertical/Horizontal steppers, Formik and standard html form with useState. Is there a preferred way to do this?
Hi,
Right now both approaches should work fine and can be reused in your project. The recommended way to handle stepper forms is by Formik
components, it makes usage easier and allows you configured form using Formik
properties. CreateAppModal.tsx example will updated in the next releases.
Regards,
Lauris Stepanovs,
Keenthemes Support Team
Is it possible to use the Stepper without the Step tracker (just the paged forms)? I'm seeing the form go to "pending" but not actually change to current, so I'm guessing this problem might be related
Hi,
Idea of Stepper component is to implement multi step forms, if you just want to use plain form without steps then you don't need our component.
Check example of plain form usage on modal form pages.
https://preview.keenthemes.com/metronic8/vue/demo1/#/crafted/modals/forms/new-target
Regards,
Lauris Stepanovs,
Keenthemes Support Team
Yes, I still want a multi-page form, but don't require a tracker/counter. Is the behavior of changing steps tied to the tracker/counter component?
Yes, I still want a multi-page form, but don't require a visual tracker/counter. Is the behavior of changing steps tied to the tracker/counter component?
Basically I don't need the counter that shows what step you're on, but I do want the form to still have multiple steps.
Hi,
It sounds like you want to remove stepper nav elements. By default, data-kt-stepper-element="nav" attributes are required for our component to work correctly, but if you don't need those nav elements you can just keep them empty and then set display: none
for stepper nav wrapper.
<div class="stepper-nav py-5 mt-5" >
<!--begin::Step 1-->
<div class="stepper-item current" data-kt-stepper-element="nav"></div>
<!--end::Step 1-->
<!--begin::Step 2-->
<div class="stepper-item" data-kt-stepper-element="nav"></div>
<!--end::Step 2-->
<!--begin::Step 3-->
<div class="stepper-item" data-kt-stepper-element="nav"></div>
<!--end::Step 3-->
<!--begin::Step 4-->
<div class="stepper-item" data-kt-stepper-element="nav"></div>
<!--end::Step 4-->
<!--begin::Step 5-->
<div class="stepper-item" data-kt-stepper-element="nav"></div>
<!--end::Step 5-->
</div>