npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2025 – Pkg Stats / Ryan Hefner

vanillajs-smartwizard

v1.0.3

Published

The awesome step wizard plugin in pure VanillaJS

Readme

VanillaJS Smart Wizard

The awesome step wizard plugin for VanillaJS

npm version jsDelivr Hits Npm Downloads GitHub license GitHub Repo Donate on Paypal

If you want to contribute to the original author click here: Original project

VanillaJS Smart Wizard is a step wizard plugin that does not require jQuery and is written in pure JavaScript. Its purpose is to provide a clean, elegant, and functional user interface for processes such as forms, checkouts, and registrations.

The project has been completely rewritten to remove the jQuery dependency, making it lighter, faster, and more modern. It supports ESM and CommonJS and works in all modern browsers. Additionally, it is designed with a responsive approach and is compatible with Bootstrap.


Main Features

  • No jQuery: Works with pure JavaScript, making it faster and lighter.
  • Easy to Implement: Requires minimal HTML to work.
  • Responsive Design: Adapts to all devices and is compatible with Bootstrap.
  • Field Validation: Allows validating required fields when moving between steps, with the option for custom events and error handling functions.
  • Transitions: Includes transition animations like fade, slideHorizontal, slideVertical, and slideSwing.
  • CSS Animation Support: Easily extendable with custom animations and compatible with libraries like Animate.css.
  • Dynamic Content: Allows integration of content through Ajax.
  • Customizable Controls: Includes a built-in toolbar, progress bar, and loader.
  • RTL Support: Ready for right-to-left languages.
  • Accessibility: Provides accessible controls for a better user experience.

Installation & Usage

The plugin is compatible with the main JavaScript module systems, making it easy to integrate into any modern project. Below are initialization examples for ESM (ECMAScript Modules) and CommonJS.

Initialization with ES Modules (ESM)

For projects using a bundler like Vite, Webpack, or Rollup, the ESM approach is the most common. First, make sure the plugin is installed in your project.

import SmartWizard from 'vanillajs-smartwizard';
import 'vanillajs-smartwizard/css'; // Or the direct path depending on the bundler

// Wizard initialization
const wizard = new SmartWizard('#smartwizard', {
    selected: 0,
    theme: 'arrows', // Example custom theme
    toolbar: {
        position: 'bottom',
    },
    // Other options...
});

// Example of using a public method
document.getElementById('nextButton').addEventListener('click', () => {
    wizard.next();
});

Initialization with CommonJS

/** Common JS **/
const SmartWizard = require('vanillajs-smartwizard');
/**
 * 
 * Remember, you must import de CSS file
 * 
 * 
 */
// Make sure the HTML is loaded before initializing
document.addEventListener('DOMContentLoaded', () => {
    // Wizard initialization
    const wizard = new SmartWizard('#smartwizard', {
        selected: 0,
        theme: 'arrows',
    });

    // Example of use
    document.getElementById('prevButton').addEventListener('click', () => {
        wizard.prev();
    });
});

Initialization with CDN/HTML

<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/[email protected]/dist/css/vanillajs.smartWizard.min.css">
<script src="https://cdn.jsdelivr.net/npm/[email protected]/dist/js/vanillajs.smartWizard.umd.min.js"></script>

Configuration Options

| Option | Type | Default Value | Description | | :---------------------- | :-------- | :-------------- | :----------------------------------------------------------------------------------------------------------------------------------- | | debug | boolean | false | Enables debug messages in the console. | | initAtCreated | boolean | true | Whether the wizard initializes automatically when created. | | selected | number | 0 | The index of the step selected at start. | | theme | string | 'basic' | The wizard theme (e.g., 'basic'). | | justified | boolean | true | Whether navigation steps are justified to take full width. | | autoAdjustHeight | boolean | true | Whether the wizard auto-adjusts its height to the content. | | backButtonSupport | boolean | true | Enables browser back button navigation. | | enableUrlHash | boolean | true | Enables using the URL hash for step navigation. | | transition | object | See source code | Transition animation settings. Includes animation (e.g., 'fade') and speed (ms). | | toolbar | object | See source code | Toolbar settings. Includes position ('top', 'bottom', 'both'), showNextButton, and showPreviousButton. | | keyboard | object | See source code | Keyboard navigation settings. Includes keyNavigation, keyLeft, and keyRight. | | lang | object | See source code | Allows customizing button texts. | | style | object | See source code | Defines CSS classes for wizard elements. | | disabledSteps | array | [] | Array of step indices to disable. | | errorSteps | array | [] | Array of step indices marked with an error state. | | hiddenSteps | array | [] | Array of step indices to hide. | | requiredField | object | See source code | Options for required field validation. Includes active, checkOnSubmitForm, controls, classInvalid, and functionToValidate. |


Public Methods (API)

| Method | Description | | :--------------------------------- | :---------------------------------------------------------------------------------------------------------------- | | goToStep(stepIndex, force) | Navigates to the specified step by stepIndex. The optional force parameter forces navigation. | | next() | Navigates to the next available step. | | prev() | Navigates to the previous available step. | | reset() | Resets the wizard to its initial state. | | setState(stepArray, state) | Sets a state (e.g., 'error', 'done') for the specified steps. | | unsetState(stepArray, state) | Removes a state from the specified steps. | | unsetErrors(idx) | Removes the error state of a specific step. | | setOptions(options) | Updates the wizard configuration with the provided options. | | getOptions() | Returns the current wizard configuration. | | getStepInfo() | Returns an object with current state info, including current step (currentStep) and total steps (totalSteps). | | loader(state) | Shows or hides the wizard loader. The state can be 'show' or 'hide'. | | fixHeight() | Forces the container to readjust its height. | | init() | Initializes the wizard if initAtCreated is false. | | checkStepRequired(step) | Validates required fields of a specific step. Returns true if there are errors, false otherwise. | | checkFormRequireds() | Validates all required fields in the form. Returns true if there are errors. | | destroy() | Removes all events and configuration, destroying the wizard instance. |

License

MIT License