Skip to content

Wizard

The Wizard component provides a step-by-step interface for guiding users through multi-step processes or forms. It features navigation buttons, progress tracking, and customizable styling options.

<div data-role="wizard">
<section>
<div class="page-content">Page 1 Content</div>
</section>
<section>
<div class="page-content">Page 2 Content</div>
</section>
<section>
<div class="page-content">Page 3 Content</div>
</section>
</div>
<div data-role="wizard" class="wizard-wide-sm">
<section>
<div class="page-content">Page 1 Content</div>
</section>
<section>
<div class="page-content">Page 2 Content</div>
</section>
<section>
<div class="page-content">Page 3 Content</div>
</section>
</div>
<div data-role="wizard" data-button-mode="square" data-button-outline="false">
<section>
<div class="page-content">Page 1 Content</div>
</section>
<section>
<div class="page-content">Page 2 Content</div>
</section>
</div>
ParameterTypeDefaultDescription
startnumber1The starting page index
finishnumber0The index of the finish page (0 means the last page)
iconHelpstring💡Icon for the help button
iconPrevstringIcon for the previous button
iconNextstringIcon for the next button
iconFinishstringIcon for the finish button
buttonModestringcycleButton style mode: cycle, square, or default
buttonOutlinebooleantrueWhether to use outline style for buttons
durationnumber300Animation duration in milliseconds
clsWizardstring""Additional CSS class for the wizard container
clsActionsstring""Additional CSS class for the actions bar
clsHelpstring""Additional CSS class for the help button
clsPrevstring""Additional CSS class for the previous button
clsNextstring""Additional CSS class for the next button
clsFinishstring""Additional CSS class for the finish button
  • next() - Navigate to the next page.
  • prev() - Navigate to the previous page.
  • first() - Navigate to the first page.
  • last() - Navigate to the last page.
  • toPage(pageIndex) - Navigate to a specific page by index.
  • destroy() - Remove the wizard component and clean up event handlers.
const wizard = Metro.getPlugin('#myWizard', 'wizard');
wizard.next(); // Go to next page
wizard.prev(); // Go to previous page
wizard.toPage(3); // Go to page 3
EventDescription
onPageTriggered when a page is displayed
onNextPageTriggered when navigating to the next page
onPrevPageTriggered when navigating to the previous page
onFirstPageTriggered when navigating to the first page
onLastPageTriggered when navigating to the last page
onFinishPageTriggered when reaching the finish page
onHelpClickTriggered when the help button is clicked
onPrevClickTriggered when the previous button is clicked
onNextClickTriggered when the next button is clicked
onFinishClickTriggered when the finish button is clicked
onBeforePrevTriggered before navigating to the previous page (return false to prevent navigation)
onBeforeNextTriggered before navigating to the next page (return false to prevent navigation)
onWizardCreateTriggered when the wizard component is created
<div data-role="wizard"
data-on-next-page="onNextPageHandler"
data-on-finish-click="onFinishClickHandler">
<!-- Wizard content -->
</div>
function onNextPageHandler(event) {
console.log('Moving to page:', event.detail.index);
}
function onFinishClickHandler(event) {
console.log('Wizard completed!');
// Process form data or navigate away
}
VariableDefault (Light)Dark ModeDescription
--wizard-height200px200pxMinimum height of the wizard
--wizard-background#ffffff#1e1f22Background color of the wizard
--wizard-color#191919#dbdfe7Text color of the wizard
--wizard-border-color#f3f3f3#484b4cBorder color of the wizard
--wizard-number-color#a8a8a8#a8a8a8Color of the step numbers
#my-wizard {
--wizard-height: 300px;
--wizard-background: #f0f0f0;
--wizard-color: #333333;
--wizard-border-color: #cccccc;
--wizard-number-color: #666666;
}
  • .wizard - The main container class (automatically added)
  • .page-content - Container for page content
  • .action-bar - Container for navigation buttons
  • .wizard-btn-help - Help button
  • .wizard-btn-prev - Previous button
  • .wizard-btn-next - Next button
  • .wizard-btn-finish - Finish button
  • .current - Applied to the current active section
  • .complete - Applied to completed sections
  • .wizard-wide-fs - Full-screen width
  • .wizard-wide-xs - Extra small width
  • .wizard-wide-sm - Small width
  • .wizard-wide-md - Medium width
  • .wizard-wide-lg - Large width
  • .wizard-wide-xl - Extra large width
  • .wizard-wide-xxl - Extra extra large width
  • .wizard-wide-xxxl - Extra extra extra large width