Overview
Stepper is an exclusive plugin of Good for handling forms with multiple steps.
Usage
Stepper's CSS and Javascript files are bundled in the global style and scripts bundles and are globally included in all pages:
copy
<link href="assets/css/style.bundle.css" rel="stylesheet" type="text/css"/>
<script src="assets/js/scripts.bundle.js"></script>
Initialization
Stepper does not come with its own custom CSS and it uses global input controls and related elements.
Stepper elements are defined with
data-kt-stepper-*
HTML attributes.
Stepper instances can be created programmatically. See below for more info.
Basic
Use
.stepper
and
.stepper-pills
classes to enable a basic form steps with title, number and icon elements:
copy
// Stepper lement
var element = document.querySelector("#kt_stepper_example_basic");
// Initialize Stepper
var stepper = new KTStepper(element);
// Handle next step
stepper.on("kt.stepper.next", function (stepper) {
stepper.goNext(); // go next step
});
// Handle previous step
stepper.on("kt.stepper.previous", function (stepper) {
stepper.goPrevious(); // go previous step
});
<!--begin::Stepper-->
<div class="stepper stepper-pills" id="kt_stepper_example_basic">
<!--begin::Nav-->
<div class="stepper-nav flex-center flex-wrap mb-10">
<!--begin::Step 1-->
<div class="stepper-item mx-2 my-4 current" data-kt-stepper-element="nav">
<!--begin::Line-->
<div class="stepper-line w-40px"></div>
<!--end::Line-->
<!--begin::Icon-->
<div class="stepper-icon w-40px h-40px">
<i class="stepper-check fas fa-check"></i>
<span class="stepper-number">1</span>
</div>
<!--end::Icon-->
<!--begin::Label-->
<div class="stepper-label">
<h3 class="stepper-title">
Step 1
</h3>
<div class="stepper-desc">
Description
</div>
</div>
<!--end::Label-->
</div>
<!--end::Step 1-->
<!--begin::Step 2-->
<div class="stepper-item mx-2 my-4" data-kt-stepper-element="nav">
<!--begin::Line-->
<div class="stepper-line w-40px"></div>
<!--end::Line-->
<!--begin::Icon-->
<div class="stepper-icon w-40px h-40px">
<i class="stepper-check fas fa-check"></i>
<span class="stepper-number">2</span>
</div>
<!--begin::Icon-->
<!--begin::Label-->
<div class="stepper-label">
<h3 class="stepper-title">
Step 2
</h3>
<div class="stepper-desc">
Description
</div>
</div>
<!--end::Label-->
</div>
<!--end::Step 2-->
<!--begin::Step 3-->
<div class="stepper-item mx-2 my-4" data-kt-stepper-element="nav">
<!--begin::Line-->
<div class="stepper-line w-40px"></div>
<!--end::Line-->
<!--begin::Icon-->
<div class="stepper-icon w-40px h-40px">
<i class="stepper-check fas fa-check"></i>
<span class="stepper-number">3</span>
</div>
<!--begin::Icon-->
<!--begin::Label-->
<div class="stepper-label">
<h3 class="stepper-title">
Step 3
</h3>
<div class="stepper-desc">
Description
</div>
</div>
<!--end::Label-->
</div>
<!--end::Step 3-->
<!--begin::Step 4-->
<div class="stepper-item mx-2 my-4" data-kt-stepper-element="nav">
<!--begin::Line-->
<div class="stepper-line w-40px"></div>
<!--end::Line-->
<!--begin::Icon-->
<div class="stepper-icon w-40px h-40px">
<i class="stepper-check fas fa-check"></i>
<span class="stepper-number">4</span>
</div>
<!--begin::Icon-->
<!--begin::Label-->
<div class="stepper-label">
<h3 class="stepper-title">
Step 4
</h3>
<div class="stepper-desc">
Description
</div>
</div>
<!--end::Label-->
</div>
<!--end::Step 4-->
</div>
<!--end::Nav-->
<!--begin::Form-->
<form class="form w-lg-500px mx-auto" novalidate="novalidate" id="kt_stepper_example_basic_form">
<!--begin::Group-->
<div class="mb-5">
<!--begin::Step 1-->
<div class="flex-column current" data-kt-stepper-element="content">
<!--begin::Input group-->
<div class="fv-row mb-10">
<!--begin::Label-->
<label class="form-label">Example Label 1</label>
<!--end::Label-->
<!--begin::Input-->
<input type="text" class="form-control form-control-solid" name="input1" placeholder="" value=""/>
<!--end::Input-->
</div>
<!--end::Input group-->
<!--begin::Input group-->
<div class="fv-row mb-10">
<!--begin::Label-->
<label class="form-label">Example Label 2</label>
<!--end::Label-->
<!--begin::Input-->
<input type="text" class="form-control form-control-solid" name="input2" placeholder="" value=""/>
<!--end::Input-->
</div>
<!--end::Input group-->
<!--begin::Input group-->
<div class="fv-row mb-10">
<!--begin::Label-->
<label class="form-label">Example Label 3</label>
<!--end::Label-->
<!--begin::Switch-->
<label class="form-check form-switch form-check-custom form-check-solid">
<input class="form-check-input" type="checkbox" checked="checked" value="1"/>
<span class="form-check-label">
Switch
</span>
</label>
<!--end::Switch-->
</div>
<!--end::Input group-->
</div>
<!--begin::Step 1-->
<!--begin::Step 1-->
<div class="flex-column" data-kt-stepper-element="content">
<!--begin::Input group-->
<div class="fv-row mb-10">
<!--begin::Label-->
<label class="form-label">Example Label 1</label>
<!--end::Label-->
<!--begin::Input-->
<input type="text" class="form-control form-control-solid" name="input1" placeholder="" value=""/>
<!--end::Input-->
</div>
<!--end::Input group-->
<!--begin::Input group-->
<div class="fv-row mb-10">
<!--begin::Label-->
<label class="form-label">Example Label 2</label>
<!--end::Label-->
<!--begin::Input-->
<textarea class="form-control form-control-solid" rows="3" name="input2" placeholder=""></textarea>
<!--end::Input-->
</div>
<!--end::Input group-->
<!--begin::Input group-->
<div class="fv-row mb-10">
<!--begin::Label-->
<label class="form-label">Example Label 3</label>
<!--end::Label-->
<!--begin::Input-->
<label class="form-check form-check-custom form-check-solid">
<input class="form-check-input" checked="checked" type="checkbox" value="1"/>
<span class="form-check-label">
Checkbox
</span>
</label>
<!--end::Input-->
</div>
<!--end::Input group-->
</div>
<!--begin::Step 1-->
<!--begin::Step 1-->
<div class="flex-column" data-kt-stepper-element="content">
<!--begin::Input group-->
<div class="fv-row mb-10">
<!--begin::Label-->
<label class="form-label d-flex align-items-center">
<span class="required">Input 1</span>
<i class="fas fa-exclamation-circle ms-2 fs-7" data-bs-toggle="tooltip" title="Example tooltip"></i>
</label>
<!--end::Label-->
<!--begin::Input-->
<input type="text" class="form-control form-control-solid" name="input1" placeholder="" value=""/>
<!--end::Input-->
</div>
<!--end::Input group-->
<!--begin::Input group-->
<div class="fv-row mb-10">
<!--begin::Label-->
<label class="form-label">
Input 2
</label>
<!--end::Label-->
<!--begin::Input-->
<input type="text" class="form-control form-control-solid" name="input2" placeholder="" value=""/>
<!--end::Input-->
</div>
<!--end::Input group-->
</div>
<!--begin::Step 1-->
<!--begin::Step 1-->
<div class="flex-column" data-kt-stepper-element="content">
<!--begin::Input group-->
<div class="fv-row mb-10">
<!--begin::Label-->
<label class="form-label d-flex align-items-center">
<span class="required">Input 1</span>
<i class="fas fa-exclamation-circle ms-2 fs-7" data-bs-toggle="tooltip" title="Example tooltip"></i>
</label>
<!--end::Label-->
<!--begin::Input-->
<input type="text" class="form-control form-control-solid" name="input1" placeholder="" value=""/>
<!--end::Input-->
</div>
<!--end::Input group-->
<!--begin::Input group-->
<div class="fv-row mb-10">
<!--begin::Label-->
<label class="form-label">
Input 2
</label>
<!--end::Label-->
<!--begin::Input-->
<input type="text" class="form-control form-control-solid" name="input2" placeholder="" value=""/>
<!--end::Input-->
</div>
<!--end::Input group-->
<!--begin::Input group-->
<div class="fv-row mb-10">
<!--begin::Label-->
<label class="form-label">
Input 3
</label>
<!--end::Label-->
<!--begin::Input-->
<input type="text" class="form-control form-control-solid" name="input3" placeholder="" value=""/>
<!--end::Input-->
</div>
<!--end::Input group-->
</div>
<!--begin::Step 1-->
</div>
<!--end::Group-->
<!--begin::Actions-->
<div class="d-flex flex-stack">
<!--begin::Wrapper-->
<div class="me-2">
<button type="button" class="btn btn-light btn-active-light-primary" data-kt-stepper-action="previous">
Back
</button>
</div>
<!--end::Wrapper-->
<!--begin::Wrapper-->
<div>
<button type="button" class="btn btn-primary" data-kt-stepper-action="submit">
<span class="indicator-label">
Submit
</span>
<span class="indicator-progress">
Please wait... <span class="spinner-border spinner-border-sm align-middle ms-2"></span>
</span>
</button>
<button type="button" class="btn btn-primary" data-kt-stepper-action="next">
Continue
</button>
</div>
<!--end::Wrapper-->
</div>
<!--end::Actions-->
</form>
<!--end::Form-->
</div>
<!--end::Stepper-->
Vertical
Use
.stepper-column
class to enable a stepper with vertical navigation layout:
Back
Submit
Please wait...
Continue
copy
// Stepper lement
var element = document.querySelector("#kt_stepper_example_vertical");
// Initialize Stepper
var stepper = new KTStepper(element);
// Handle next step
stepper.on("kt.stepper.next", function (stepper) {
stepper.goNext(); // go next step
});
// Handle previous step
stepper.on("kt.stepper.previous", function (stepper) {
stepper.goPrevious(); // go previous step
});
<!--begin::Stepper-->
<div class="stepper stepper-pills stepper-column d-flex flex-column flex-lg-row" id="kt_stepper_example_vertical">
<!--begin::Aside-->
<div class="d-flex flex-row-auto w-100 w-lg-300px">
<!--begin::Nav-->
<div class="stepper-nav flex-cente">
<!--begin::Step 1-->
<div class="stepper-item me-5 current" data-kt-stepper-element="nav">
<!--begin::Line-->
<div class="stepper-line w-40px"></div>
<!--end::Line-->
<!--begin::Icon-->
<div class="stepper-icon w-40px h-40px">
<i class="stepper-check fas fa-check"></i>
<span class="stepper-number">1</span>
</div>
<!--end::Icon-->
<!--begin::Label-->
<div class="stepper-label">
<h3 class="stepper-title">
Step 1
</h3>
<div class="stepper-desc">
Description
</div>
</div>
<!--end::Label-->
</div>
<!--end::Step 1-->
<!--begin::Step 2-->
<div class="stepper-item me-5" data-kt-stepper-element="nav">
<!--begin::Line-->
<div class="stepper-line w-40px"></div>
<!--end::Line-->
<!--begin::Icon-->
<div class="stepper-icon w-40px h-40px">
<i class="stepper-check fas fa-check"></i>
<span class="stepper-number">2</span>
</div>
<!--begin::Icon-->
<!--begin::Label-->
<div class="stepper-label">
<h3 class="stepper-title">
Step 2
</h3>
<div class="stepper-desc">
Description
</div>
</div>
<!--end::Label-->
</div>
<!--end::Step 2-->
<!--begin::Step 3-->
<div class="stepper-item me-5" data-kt-stepper-element="nav">
<!--begin::Line-->
<div class="stepper-line w-40px"></div>
<!--end::Line-->
<!--begin::Icon-->
<div class="stepper-icon w-40px h-40px">
<i class="stepper-check fas fa-check"></i>
<span class="stepper-number">3</span>
</div>
<!--begin::Icon-->
<!--begin::Label-->
<div class="stepper-label">
<h3 class="stepper-title">
Step 3
</h3>
<div class="stepper-desc">
Description
</div>
</div>
<!--end::Label-->
</div>
<!--end::Step 3-->
<!--begin::Step 4-->
<div class="stepper-item me-5" data-kt-stepper-element="nav">
<!--begin::Line-->
<div class="stepper-line w-40px"></div>
<!--end::Line-->
<!--begin::Icon-->
<div class="stepper-icon w-40px h-40px">
<i class="stepper-check fas fa-check"></i>
<span class="stepper-number">4</span>
</div>
<!--begin::Icon-->
<!--begin::Label-->
<div class="stepper-label">
<h3 class="stepper-title">
Step 4
</h3>
<div class="stepper-desc">
Description
</div>
</div>
<!--end::Label-->
</div>
<!--end::Step 4-->
</div>
<!--end::Nav-->
</div>
<!--begin::Content-->
<div class="flex-row-fluid">
<!--begin::Form-->
<form class="form w-lg-500px mx-auto" novalidate="novalidate">
<!--begin::Group-->
<div class="mb-5">
<!--begin::Step 1-->
<div class="flex-column current" data-kt-stepper-element="content">
<!--begin::Input group-->
<div class="fv-row mb-10">
<!--begin::Label-->
<label class="form-label">Example Label 1</label>
<!--end::Label-->
<!--begin::Input-->
<input type="text" class="form-control form-control-solid" name="input1" placeholder="" value=""/>
<!--end::Input-->
</div>
<!--end::Input group-->
<!--begin::Input group-->
<div class="fv-row mb-10">
<!--begin::Label-->
<label class="form-label">Example Label 2</label>
<!--end::Label-->
<!--begin::Input-->
<input type="text" class="form-control form-control-solid" name="input2" placeholder="" value=""/>
<!--end::Input-->
</div>
<!--end::Input group-->
<!--begin::Input group-->
<div class="fv-row mb-10">
<!--begin::Label-->
<label class="form-label">Example Label 3</label>
<!--end::Label-->
<!--begin::Switch-->
<label class="form-check form-switch form-check-custom form-check-solid">
<input class="form-check-input" type="checkbox" checked="checked" value="1"/>
<span class="form-check-label">
Switch
</span>
</label>
<!--end::Switch-->
</div>
<!--end::Input group-->
</div>
<!--begin::Step 1-->
<!--begin::Step 1-->
<div class="flex-column" data-kt-stepper-element="content">
<!--begin::Input group-->
<div class="fv-row mb-10">
<!--begin::Label-->
<label class="form-label">Example Label 1</label>
<!--end::Label-->
<!--begin::Input-->
<input type="text" class="form-control form-control-solid" name="input1" placeholder="" value=""/>
<!--end::Input-->
</div>
<!--end::Input group-->
<!--begin::Input group-->
<div class="fv-row mb-10">
<!--begin::Label-->
<label class="form-label">Example Label 2</label>
<!--end::Label-->
<!--begin::Input-->
<textarea class="form-control form-control-solid" rows="3" name="input2" placeholder=""></textarea>
<!--end::Input-->
</div>
<!--end::Input group-->
<!--begin::Input group-->
<div class="fv-row mb-10">
<!--begin::Label-->
<label class="form-label">Example Label 3</label>
<!--end::Label-->
<!--begin::Input-->
<label class="form-check form-check-custom form-check-solid">
<input class="form-check-input" checked="checked" type="checkbox" value="1"/>
<span class="form-check-label">
Checkbox
</span>
</label>
<!--end::Input-->
</div>
<!--end::Input group-->
</div>
<!--begin::Step 1-->
<!--begin::Step 1-->
<div class="flex-column" data-kt-stepper-element="content">
<!--begin::Input group-->
<div class="fv-row mb-10">
<!--begin::Label-->
<label class="form-label d-flex align-items-center">
<span class="required">Input 1</span>
<i class="fas fa-exclamation-circle ms-2 fs-7" data-bs-toggle="tooltip" title="Example tooltip"></i>
</label>
<!--end::Label-->
<!--begin::Input-->
<input type="text" class="form-control form-control-solid" name="input1" placeholder="" value=""/>
<!--end::Input-->
</div>
<!--end::Input group-->
<!--begin::Input group-->
<div class="fv-row mb-10">
<!--begin::Label-->
<label class="form-label">
Input 2
</label>
<!--end::Label-->
<!--begin::Input-->
<input type="text" class="form-control form-control-solid" name="input2" placeholder="" value=""/>
<!--end::Input-->
</div>
<!--end::Input group-->
</div>
<!--begin::Step 1-->
<!--begin::Step 1-->
<div class="flex-column" data-kt-stepper-element="content">
<!--begin::Input group-->
<div class="fv-row mb-10">
<!--begin::Label-->
<label class="form-label d-flex align-items-center">
<span class="required">Input 1</span>
<i class="fas fa-exclamation-circle ms-2 fs-7" data-bs-toggle="tooltip" title="Example tooltip"></i>
</label>
<!--end::Label-->
<!--begin::Input-->
<input type="text" class="form-control form-control-solid" name="input1" placeholder="" value=""/>
<!--end::Input-->
</div>
<!--end::Input group-->
<!--begin::Input group-->
<div class="fv-row mb-10">
<!--begin::Label-->
<label class="form-label">
Input 2
</label>
<!--end::Label-->
<!--begin::Input-->
<input type="text" class="form-control form-control-solid" name="input2" placeholder="" value=""/>
<!--end::Input-->
</div>
<!--end::Input group-->
<!--begin::Input group-->
<div class="fv-row mb-10">
<!--begin::Label-->
<label class="form-label">
Input 3
</label>
<!--end::Label-->
<!--begin::Input-->
<input type="text" class="form-control form-control-solid" name="input3" placeholder="" value=""/>
<!--end::Input-->
</div>
<!--end::Input group-->
</div>
<!--begin::Step 1-->
</div>
<!--end::Group-->
<!--begin::Actions-->
<div class="d-flex flex-stack">
<!--begin::Wrapper-->
<div class="me-2">
<button type="button" class="btn btn-light btn-active-light-primary" data-kt-stepper-action="previous">
Back
</button>
</div>
<!--end::Wrapper-->
<!--begin::Wrapper-->
<div>
<button type="button" class="btn btn-primary" data-kt-stepper-action="submit">
<span class="indicator-label">
Submit
</span>
<span class="indicator-progress">
Please wait... <span class="spinner-border spinner-border-sm align-middle ms-2"></span>
</span>
</button>
<button type="button" class="btn btn-primary" data-kt-stepper-action="next">
Continue
</button>
</div>
<!--end::Wrapper-->
</div>
<!--end::Actions-->
</form>
<!--end::Form-->
</div>
</div>
<!--end::Stepper-->
Clickable Navigation
Add
data-kt-stepper-action="step"
attribute to Stepper navigation links to setup a Stepper with clickable navigation:
Back
Submit
Please wait...
Continue
copy
// Stepper lement
var element = document.querySelector("#kt_stepper_example_clickable");
// Initialize Stepper
var stepper = new KTStepper(element);
// Handle navigation click
stepper.on("kt.stepper.click", function (stepper) {
stepper.goTo(stepper.getClickedStepIndex()); // go to clicked step
});
// Handle next step
stepper.on("kt.stepper.next", function (stepper) {
stepper.goNext(); // go next step
});
// Handle previous step
stepper.on("kt.stepper.previous", function (stepper) {
stepper.goPrevious(); // go previous step
});
<!--begin::Stepper-->
<div class="stepper stepper-pills" id="kt_stepper_example_clickable">
<!--begin::Nav-->
<div class="stepper-nav flex-center flex-wrap mb-10">
<!--begin::Step 1-->
<div class="stepper-item mx-2 my-4 current" data-kt-stepper-element="nav" data-kt-stepper-action="step">
<!--begin::Line-->
<div class="stepper-line w-40px"></div>
<!--end::Line-->
<!--begin::Icon-->
<div class="stepper-icon w-40px h-40px">
<i class="stepper-check fas fa-check"></i>
<span class="stepper-number">1</span>
</div>
<!--end::Icon-->
<!--begin::Label-->
<div class="stepper-label">
<h3 class="stepper-title">
Step 1
</h3>
<div class="stepper-desc">
Description
</div>
</div>
<!--end::Label-->
</div>
<!--end::Step 1-->
<!--begin::Step 2-->
<div class="stepper-item mx-2 my-4" data-kt-stepper-element="nav" data-kt-stepper-action="step">
<!--begin::Line-->
<div class="stepper-line w-40px"></div>
<!--end::Line-->
<!--begin::Icon-->
<div class="stepper-icon w-40px h-40px">
<i class="stepper-check fas fa-check"></i>
<span class="stepper-number">2</span>
</div>
<!--begin::Icon-->
<!--begin::Label-->
<div class="stepper-label">
<h3 class="stepper-title">
Step 2
</h3>
<div class="stepper-desc">
Description
</div>
</div>
<!--end::Label-->
</div>
<!--end::Step 2-->
<!--begin::Step 3-->
<div class="stepper-item mx-2 my-4" data-kt-stepper-element="nav" data-kt-stepper-action="step">
<!--begin::Line-->
<div class="stepper-line w-40px"></div>
<!--end::Line-->
<!--begin::Icon-->
<div class="stepper-icon w-40px h-40px">
<i class="stepper-check fas fa-check"></i>
<span class="stepper-number">3</span>
</div>
<!--begin::Icon-->
<!--begin::Label-->
<div class="stepper-label">
<h3 class="stepper-title">
Step 3
</h3>
<div class="stepper-desc">
Description
</div>
</div>
<!--end::Label-->
</div>
<!--end::Step 3-->
<!--begin::Step 4-->
<div class="stepper-item mx-2 my-4" data-kt-stepper-element="nav" data-kt-stepper-action="step">
<!--begin::Line-->
<div class="stepper-line w-40px"></div>
<!--end::Line-->
<!--begin::Icon-->
<div class="stepper-icon w-40px h-40px">
<i class="stepper-check fas fa-check"></i>
<span class="stepper-number">4</span>
</div>
<!--begin::Icon-->
<!--begin::Label-->
<div class="stepper-label">
<h3 class="stepper-title">
Step 4
</h3>
<div class="stepper-desc">
Description
</div>
</div>
<!--end::Label-->
</div>
<!--end::Step 4-->
</div>
<!--end::Nav-->
<!--begin::Form-->
<form class="form w-lg-500px mx-auto" novalidate="novalidate" id="kt_stepper_example_basic_form">
<!--begin::Group-->
<div class="mb-5">
<!--begin::Step 1-->
<div class="flex-column current" data-kt-stepper-element="content">
<!--begin::Input group-->
<div class="fv-row mb-10">
<!--begin::Label-->
<label class="form-label">Example Label 1</label>
<!--end::Label-->
<!--begin::Input-->
<input type="text" class="form-control form-control-solid" name="input1" placeholder="" value=""/>
<!--end::Input-->
</div>
<!--end::Input group-->
<!--begin::Input group-->
<div class="fv-row mb-10">
<!--begin::Label-->
<label class="form-label">Example Label 2</label>
<!--end::Label-->
<!--begin::Input-->
<input type="text" class="form-control form-control-solid" name="input2" placeholder="" value=""/>
<!--end::Input-->
</div>
<!--end::Input group-->
<!--begin::Input group-->
<div class="fv-row mb-10">
<!--begin::Label-->
<label class="form-label">Example Label 3</label>
<!--end::Label-->
<!--begin::Switch-->
<label class="form-check form-switch form-check-custom form-check-solid">
<input class="form-check-input" type="checkbox" checked="checked" value="1"/>
<span class="form-check-label">
Switch
</span>
</label>
<!--end::Switch-->
</div>
<!--end::Input group-->
</div>
<!--begin::Step 1-->
<!--begin::Step 1-->
<div class="flex-column" data-kt-stepper-element="content">
<!--begin::Input group-->
<div class="fv-row mb-10">
<!--begin::Label-->
<label class="form-label">Example Label 1</label>
<!--end::Label-->
<!--begin::Input-->
<input type="text" class="form-control form-control-solid" name="input1" placeholder="" value=""/>
<!--end::Input-->
</div>
<!--end::Input group-->
<!--begin::Input group-->
<div class="fv-row mb-10">
<!--begin::Label-->
<label class="form-label">Example Label 2</label>
<!--end::Label-->
<!--begin::Input-->
<textarea class="form-control form-control-solid" rows="3" name="input2" placeholder=""></textarea>
<!--end::Input-->
</div>
<!--end::Input group-->
<!--begin::Input group-->
<div class="fv-row mb-10">
<!--begin::Label-->
<label class="form-label">Example Label 3</label>
<!--end::Label-->
<!--begin::Input-->
<label class="form-check form-check-custom form-check-solid">
<input class="form-check-input" checked="checked" type="checkbox" value="1"/>
<span class="form-check-label">
Checkbox
</span>
</label>
<!--end::Input-->
</div>
<!--end::Input group-->
</div>
<!--begin::Step 1-->
<!--begin::Step 1-->
<div class="flex-column" data-kt-stepper-element="content">
<!--begin::Input group-->
<div class="fv-row mb-10">
<!--begin::Label-->
<label class="form-label d-flex align-items-center">
<span class="required">Input 1</span>
<i class="fas fa-exclamation-circle ms-2 fs-7" data-bs-toggle="tooltip" title="Example tooltip"></i>
</label>
<!--end::Label-->
<!--begin::Input-->
<input type="text" class="form-control form-control-solid" name="input1" placeholder="" value=""/>
<!--end::Input-->
</div>
<!--end::Input group-->
<!--begin::Input group-->
<div class="fv-row mb-10">
<!--begin::Label-->
<label class="form-label">
Input 2
</label>
<!--end::Label-->
<!--begin::Input-->
<input type="text" class="form-control form-control-solid" name="input2" placeholder="" value=""/>
<!--end::Input-->
</div>
<!--end::Input group-->
</div>
<!--begin::Step 1-->
<!--begin::Step 1-->
<div class="flex-column" data-kt-stepper-element="content">
<!--begin::Input group-->
<div class="fv-row mb-10">
<!--begin::Label-->
<label class="form-label d-flex align-items-center">
<span class="required">Input 1</span>
<i class="fas fa-exclamation-circle ms-2 fs-7" data-bs-toggle="tooltip" title="Example tooltip"></i>
</label>
<!--end::Label-->
<!--begin::Input-->
<input type="text" class="form-control form-control-solid" name="input1" placeholder="" value=""/>
<!--end::Input-->
</div>
<!--end::Input group-->
<!--begin::Input group-->
<div class="fv-row mb-10">
<!--begin::Label-->
<label class="form-label">
Input 2
</label>
<!--end::Label-->
<!--begin::Input-->
<input type="text" class="form-control form-control-solid" name="input2" placeholder="" value=""/>
<!--end::Input-->
</div>
<!--end::Input group-->
<!--begin::Input group-->
<div class="fv-row mb-10">
<!--begin::Label-->
<label class="form-label">
Input 3
</label>
<!--end::Label-->
<!--begin::Input-->
<input type="text" class="form-control form-control-solid" name="input3" placeholder="" value=""/>
<!--end::Input-->
</div>
<!--end::Input group-->
</div>
<!--begin::Step 1-->
</div>
<!--end::Group-->
<!--begin::Actions-->
<div class="d-flex flex-stack">
<!--begin::Wrapper-->
<div class="me-2">
<button type="button" class="btn btn-light btn-active-light-primary" data-kt-stepper-action="previous">
Back
</button>
</div>
<!--end::Wrapper-->
<!--begin::Wrapper-->
<div>
<button type="button" class="btn btn-primary" data-kt-stepper-action="submit">
<span class="indicator-label">
Submit
</span>
<span class="indicator-progress">
Please wait... <span class="spinner-border spinner-border-sm align-middle ms-2"></span>
</span>
</button>
<button type="button" class="btn btn-primary" data-kt-stepper-action="next">
Continue
</button>
</div>
<!--end::Wrapper-->
</div>
<!--end::Actions-->
</form>
<!--end::Form-->
</div>
<!--end::Stepper-->
Markup Reference
For the sake of design abstraction Stepper does not depend on design structure with CSS classes. Instead, it defines it's dependant elements via HTML attributes explained in the below table:
Name
Description
data-kt-stepper-element="nav"
Represents a step's navigation indicator element that may contain of step title, description, icon and number.
data-kt-stepper-element="content"
Represents a step content element that may contain of form elements.
data-kt-stepper-action="next"
Represents a next button.
data-kt-stepper-action="previous"
Represents a previous button.
data-kt-stepper-action="submit"
Represents a submit button that is shown in final step.
data-kt-stepper-action="step"
Enables clickable steps when set to stepper navigation links.
.current
,
.pending
and
.completed
classes are applied to
data-kt-stepper-element="nav"
and
data-kt-stepper-element="content"
elements to highlight current, pending and competed step states.
Methods
The following are the Stepper's functionality methods for more control.
Name
Description
KTStepper(DOMElement element, Object options)
Constructs a stepper object by given DOM element and options.
startIndex
is starting steps index. Default value is
startIndex: 1
copy
var stepperEl = document.querySelector("#kt_stepper_example");
var options = {startIndex: 1};
var stepper = new KTStepper(stepperEl, options);
goTo(Integer index)
Activates a step by given index.
index
is an integer value(e.g: 1, 2, 3 ...) that represents the step's order number.
goNext()
Activates next step.
goPrevious()
Activates previous step.
goFirst()
Activates the first step.
goLast()
Activates the last step.
getClickedStepIndex()
Returns the clicked step index number as integer when stepper nav link is set with
data-kt-stepper-action="step"
attribute.
copy
stepper.getClickedStepIndex();
getCurrentStepIndex()
Returns the current step index number as integer.
copy
stepper.getCurrentStepIndex();
getNextStepIndex()
Returns the next step's index number as integer.
copy
stepper.getNextStepIndex();
getPreviousStepIndex()
Returns the previous step's index number as integer.
copy
stepper.getPreviousStepIndex();
getElement()
Returns the Stepper's attached DOM element.
copy
var element = stepper.getElement();
destroy()
Removes the component instance from element.
Static Methods
getInstance(DOMElement element)
Get the Stepper instance created
copy
var stepperElement = document.querySelector("#kt_stepper_example_1");
var stepper = KTStepper.getInstance(stepperElement);
Events
Below are few events for hooking into the Stepper functionality.
Event Type
Description
kt.stepper.next
This event fires on next navigation button click.
copy
var stepperEl = document.querySelector("#kt_stepper_example");
var stepper = new KTStepper(stepperEl);
stepper.on("kt.stepper.next", function() {
// console.log("kt.stepper.next event is fired");
});
kt.stepper.previous
This event fires on previous navigation button click.
copy
stepper.on("kt.stepper.previous", function() {
// console.log("kt.stepper.previous event is fired");
});
kt.stepper.change
This event fires before current step change.
copy
stepper.on("kt.stepper.change", function() {
// console.log("kt.stepper.change event is fired");
});
kt.stepper.changed
This event fires after current step change.
copy
stepper.on("kt.stepper.changed", function() {
// console.log("kt.stepper.changed event is fired");
});
kt.stepper.click
This event fires on clickable navigation link click.
copy
stepper.on("kt.stepper.click", function() {
stepper.goTo(stepper.getClickedStepIndex()); // go to clicked step
});