<vega-progress-tracker
id="prog-track"
direction="vertical"
current="1"
>
</vega-progress-tracker>
const vegaProgressTracker = document.getElementById("prog-track");
vegaProgressTracker.steps = ["Basic Information", "Contact Information", "Emergency Contact","W-2 Forms"];
<vega-progress-tracker
id="prog-track"
direction="horizontal"
current="1"
>
</vega-progress-tracker>
const vegaProgressTracker = document.getElementById("prog-track");
vegaProgressTracker.steps = ["Basic Information", "Contact Information", "Emergency Contact","W-2 Forms"];
Note: The above examples use Vanilla JS. If you would like to use React, Angular, or Vue, please consult Storybook.
The vega-progress-tracker
component tracks the progress of movement through sections of a page, or through multiple pages. It is useful for users to be able to know how much of a form or article they have completed.
It consists of a vertical list of sequential items with indicators showing to what extent a process has been completed.
Name | Description | Default |
---|---|---|
direction | This specifies the direction of the progress tracker. It currently supports both horizontal and vertical directions. Vertical trackers show on one pane. Horizontal trackers show on different panes, which are navigable with right and left arrows. | vertical |
steps | The array of steps in the progress tracker | 0 |
current | Specifies the current progress, beginning with 0 number |
|
completed-step-array | The completed steps stored as an array | |
can-click-step | Allows clicking the steps in the progress tracker. Boolean | true |
<vega-progress-tracker
id="vega-progress-tracker"
direction="horizontal | vertical"
can-click-step=true|false
>
</vega-progress-tracker >
The vega-progress-tracker
supports vertical, horizontal, and mobile layouts, and will also support responsive design.
breakpoint less than 768px | breakpoint greater than or equal to 768px |
---|---|
mobile | vertical/horizontal |
The progress tracker controls whether steps can be skipped through the property canClickStep
:
canClickStep
is set to true, it is used to fill in the order of steps without strict requirements. Some steps can be left blank.canClickStep
is set to false, strict control must be completed step by step, and the next step can only be entered after the previous step is completed.After completing each step, you can set the completedStepArray
property to mark those steps as completed.
const progressTracker = document.getElementById('vega-progress-tracker');
progressTracker.addEventListener('vegaCurrentStepUpdate', e => {
if (!progressTracker.completedStepArray.includes(e.detail)) {
progressTracker.completedStepArray.push(e.detail);
}
});
Note: To make the the progress tracker fully functional, you must include the following code. This reveals four functions:
setCurrent
,getCurrent
,nextStep
andprevStep
.
const progressTracker = document.getElementById('vega-progress-tracker');
progressTracker.setCurrent(1);
progressTracker.getCurrent();
progressTracker.nextStep();
progressTracker.prevStep();
The vegaCurrentStepUpdate
event is emitted when the progress tracker is changed.
document.getElementById("vega-progress-tracker").addEventListener("vegaCurrentStepUpdate", (e) => { // do something })
For more details, including examples in React and Vue, view in Storybook.