Get 2024 Templates Mega Bundle!14 Bootstrap, Vue & React Templates + 3 Vector Sets
Get for 99$

How to use Stepper in React version of Metronic 8?


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?


Text formatting options
Submit
Here's a how to add some HTML formatting to your comment:
  • <pre></pre> for JS codes block
  • <pre lang="html"></pre> for HTML code block
  • <pre lang="scss"></pre> for SCSS code block
  • <pre lang="php"></pre> for PHP code block
  • <code></code> for single line of code
  • <strong></strong> to make things bold
  • <em></em> to emphasize
  • <ul><li></li></ul>  to make list
  • <ol><li></li></ol>  to make ordered list
  • <h3></h3> to make headings
  • <a></a> for links
  • <img> to paste in an image
  • <blockquote></blockquote> to quote somebody
  • happy  :)
  • shocked  :|
  • sad  :(

Replies (10)


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"


Usage examples can be found in src/_metronic/partials/modals/create-app-stepper/CreateAppModal.tsx,src/app/modules/wizards/components/Horizontal.tsx and src/app/modules/wizards/components/Vertical.tsx.

Regards,
Lauris Stepanovs,
Keenthemes Support Team



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>


Regards,
Lauris Stepanovs,
Keenthemes Support Team


Text formatting options
Submit
Here's a how to add some HTML formatting to your comment:
  • <pre></pre> for JS codes block
  • <pre lang="html"></pre> for HTML code block
  • <pre lang="scss"></pre> for SCSS code block
  • <pre lang="php"></pre> for PHP code block
  • <code></code> for single line of code
  • <strong></strong> to make things bold
  • <em></em> to emphasize
  • <ul><li></li></ul>  to make list
  • <ol><li></li></ol>  to make ordered list
  • <h3></h3> to make headings
  • <a></a> for links
  • <img> to paste in an image
  • <blockquote></blockquote> to quote somebody
  • happy  :)
  • shocked  :|
  • sad  :(
Text formatting options
Submit
Here's a how to add some HTML formatting to your comment:
  • <pre></pre> for JS codes block
  • <pre lang="html"></pre> for HTML code block
  • <pre lang="scss"></pre> for SCSS code block
  • <pre lang="php"></pre> for PHP code block
  • <code></code> for single line of code
  • <strong></strong> to make things bold
  • <em></em> to emphasize
  • <ul><li></li></ul>  to make list
  • <ol><li></li></ol>  to make ordered list
  • <h3></h3> to make headings
  • <a></a> for links
  • <img> to paste in an image
  • <blockquote></blockquote> to quote somebody
  • happy  :)
  • shocked  :|
  • sad  :(