The Vue 3 migrated version may have breaking changes!
Description
<wui-multi-step>
is simple component that is used in multi-step process, it shows the users where they are, what has already been done and what still needs to be done.
<wui-multi-step :steps="steps" v-model="currentStep" />
Steps data
To display steps developers need to pass property steps
. It is array of step objects that needs to have specific structure. icon
is Font Awesome icon name see Icon
page. label
and content
are optional and it's used to display label above the line connecting two steps and simple content centered below icon. completed
, disabled
and busy
are self-explanatory and used to display step state. to
and href
properties can be used to open link on step bubble icon or label click.
<wui-multi-step :steps="steps" v-model="currentStep" />
<script>
export default {
data() {
return {
steps: [
{
icon: "user-hair-buns",
label: "",
content: "",
completed: false,
disabled: false,
busy: false,
},
{
icon: "starship-freighter",
label: "",
content: "",
completed: false,
disabled: true,
busy: false,
},
{
icon: "space-station-moon-construction",
label: "",
content: "",
completed: false,
disabled: true,
busy: false,
},
{
icon: "explosion",
label: "",
content: "",
completed: false,
disabled: true,
busy: false,
},
],
currentStep: 1,
};
},
};
</script>
v-model
binding
If you bind a variable to the v-model
prop, value will be the current step. Step progress is controlled by developers, based on above mentioned steps object data.
<wui-multi-step :steps="steps" v-model="computedStep" />
<script>
export default {
data() {
return {
steps: [
{
icon: "user-hair-buns",
label: "",
content: "",
completed: false,
disabled: false,
busy: false,
},
{
icon: "starship-freighter",
label: "",
content: "",
completed: false,
disabled: true,
busy: false,
},
{
icon: "space-station-moon-construction",
label: "",
content: "",
completed: false,
disabled: true,
busy: false,
},
{
icon: "explosion",
label: "",
content: "",
completed: false,
disabled: true,
busy: false,
},
],
currentStep: 1,
};
},
computed: {
computedStep: {
get() {
return this.currentStep;
},
set(step) {
const stepIndex = step - 1;
const clickedStep = this.steps[stepIndex];
const currentStep = this.steps[this.currentStep - 1];
// If step value i.e. label is required to complete current step before progressing to next step
if (currentStep.label) {
currentStep.completed = true;
}
if (!clickedStep.disabled) {
this.currentStep = step;
}
},
},
},
};
</script>
Component reference
<wui-multi-step>
Properties
Property | Type | Default | Description |
---|
steps | Array | undefined | Array of step data objects. |
size | String | "regular" | Display size of step bubble, supported values are "small" , "regular" and "large" . |
step | Number | undefined | v-model - Current step. |
variant | String | "regular" | Used to change color scheme. Currently supported variants are "regular" and "light". |
orientation | String | "horizontal" | Used to change orientation of multi-step component. Supported orientation values are "horizontal" and "vertical". |
v-model
Events
Event | Arguments | Description |
---|
step-click | event - Click event. step - Clicked step number | Event that's emitted when user click on step bubble or value. Cancelable, call event.preventDefault() to cancel click event and subsequent update event to disable v-model value update. |
update | step - Current step value | v-model event to update step value. |
Slots
Name | Scoped | Description |
---|
default | No | Content to place in multi-step list wrapper. |
<wui-multi-step-item>
Properties
Property | Type | Default | Description |
---|
active | Boolean | false | Display active state for step item. |
completed | Boolean | false | Display completed state for step item. |
disabled | Boolean | false | Display disabled state for step item. |
busy | Boolean | false | Display busy state for step item i.e. Display spinner instead of icon |
danger | Boolean | false | Display danger state for step item. |
href | String | | <wui-link> prop: Denotes the target URL of the link for standard a links |
icon | String | | Font Awesome icon name see Icon page. |
label | String | | Display label above the line connecting two steps. |
content | String | | Display content centered below step icon in horizontal orientation, or on icon right side in vertical orientation |
stepIndex | Number | 0 | Pass step index to default icon and label components to control default visibility for label component and to output value on click events. |
to | Object or String | | <wui-link> prop: Denotes the target route of the link. When clicked, the value of the to prop will be passed to router.push() internally, so the value can be either a string or a Location descriptor object. |
totalSteps | Number | | Pass total steps number to label components to control default visibility for label component. |
Slots
Name | Scoped | Description |
---|
default | No | Content to place in multi-step item wrapper. |
label | No | Content to place in multi-step item instead of label sub component. |
icon | No | Content to place in multi-step item instead of icon sub component. |
content | No | Content to place in multi-step item instead of content sub component. |
<wui-multi-step-item-icon>
Properties
Property | Type | Default | Description |
---|
disabled | Boolean | false | <wui-link> prop: Disable component functionality. |
busy | Boolean | false | Display spinner instead of icon |
href | String | | <wui-link> prop: Denotes the target URL of the link for standard a links |
icon | String | | Font Awesome icon name see Icon page. |
stepIndex | Number | 0 | Pass step index to default icon and label components to control default visibility for label component and to output value on click events. |
to | Object or String | | <wui-link> prop: Denotes the target route of the link. When clicked, the value of the to prop will be passed to router.push() internally, so the value can be either a string or a Location descriptor object. |
Slots
Name | Scoped | Description |
---|
default | No | Content to place in multi-step icon wrapper. |
<wui-multi-step-item-label>
Properties
Property | Type | Default | Description |
---|
disabled | Boolean | false | <wui-link> prop: Disable component functionality. |
href | String | | <wui-link> prop: Denotes the target URL of the link for standard a links |
label | String | | Displayed label. |
stepIndex | Number | 0 | Pass step index to default icon and label components to control default visibility for label component and to output value on click events. |
to | Object or String | | <wui-link> prop: Denotes the target route of the link. When clicked, the value of the to prop will be passed to router.push() internally, so the value can be either a string or a Location descriptor object. |
Slots
Name | Scoped | Description |
---|
default | No | Content to place in multi-step label wrapper. |
<wui-multi-step-item-content>
Properties
Property | Type | Default | Description |
---|
content | String | "" | Content to display |
Slots
Name | Scoped | Description |
---|
default | No | Content to place in multi-step content wrapper. |
Importing individual components
You can import individual components into your project via the following named exports:
Component | Named Export |
---|
<wui-multi-step> | WuiMultiStep |
<wui-multi-step-item> | WuiMultiStepItem |
<wui-multi-step-item-icon> | WuiMultiStepItemIcon |
<wui-multi-step-item-label> | WuiMultiStepItemLabel |
<wui-multi-step-item-content> | WuiMultiStepItemContent |
Example
import { WuiMultiStep } from "@wui/wui-vue/lib/multi-step";
Vue.component("wui-multi-step", WuiMultiStep);
Importing as a Vue.js plugin
This plugin includes all of the above listed individual components. Plugins also include any component aliases.
Named Export | Import Path |
---|
MultiStepPlugin | @wui/wui-vue/lib/multi-step |
Example
import { MultiStepPlugin } from "@wui/wui-vue/lib/multi-step";
Vue.use(MultiStepPlugin);