Vue Simple Stepper

1
Step 1
1

2

3

Stepper component designed to guide users through a multi-step process, like a registration form or setup process. It provides a clear indication of the current, completed, and upcoming steps, and also allows for navigating between these steps.

Features

  • Dynamically renders a specified number of steps based on the steps prop.
  • Keeps track of the current step and which steps have been visited.
  • Allows for customization of the header and action buttons via slots.
  • Emits events when the user navigates through the steps.
  • Handles step navigation logic, showing and hiding appropriate elements as needed.

Installation

Install it from npm

npm install vue-simple-stepper

You need to import the component doing:

import VueSimpleStepper from 'vue-simple-stepper'

And its styles like this:

import "vue-simple-stepper/dist/style.css";

Use

The easiest way to use is to copy and throw this in your code:

Any element found in the default slot of the component will be automatically added to the stepper. Notice that the steps data prop number coincides with the number of elements in the stepper.

You can set a default starting point of the component with the step prop. With it you can also control the stepper programmatically.

Any time the actions of the stepper are clicked the events:

  • click:next
  • click:previous
  • click:submit Are going to be emitted in by the stepper on click of the respective action.

One common problem is the customization of the stepper to fit the framework or styles of choice. In that case you can do it by using the CSS variables:

Or in case you want to further customize the buttons you can overwrite or extend these classes:

In case that you need to overwrite completely the action buttons do it by using the actions slot like so:

1
Step 1
1

2

3
asdfasd

Props

  • steps: An array that defines the steps in the stepper. The length of the array determines the number of steps. Default is an empty array.
  • step: A number indicating the current step. Starts from 1 and default is 1.

Events

  • click:next: Triggered when the next button is clicked.
  • click:previous: Triggered when the previous button is clicked.
  • click:submit: Triggered when the submit button is clicked.

Slots

  • actions: For customizing the action buttons (next, previous, submit) of the stepper.