2020-08-13 11:47:56 +08:00
# Steps
## Demos
### Size and direction variants
2021-10-20 01:11:27 +08:00
Available style variants for the [`ui` ](#props-ui ) prop: `s` / `m` / `vertical` / `label-vertical` .
2020-08-13 11:47:56 +08:00
[[ demo src="/demo/steps/default.vue" ]]
### Step status
Set `status` property of the `step` to `error` , if the step fails.
[[ demo src="/demo/steps/status.vue" ]]
## API
### Props
| Name | Type | Default | Description |
| -- | -- | -- | -- |
2021-10-20 01:11:27 +08:00
| ``ui`` | `string=` | - | [^ui] |
| ``steps`` | `Array` | - | [^steps] |
| ``current`` | `number` | - | The index of current step. |
2020-08-13 11:47:56 +08:00
^^^ui
Style variants.
+++Enum values
| Value | Description |
| -- | -- |
| `s` | Small style. |
| `m` | Medium. |
| `vertical` | Vertical style. |
| `label-vertical` | Label vertical style. |
+++
^^^
^^^steps
The datasource of steps with item type being `{ label, desc, to, status }` .
+++Properties
| Name | Type | | Description |
| -- | -- | -- |
| `label` | `string` | The label of the step. |
| `desc` | `string` | The description of the step. |
2021-10-20 01:11:27 +08:00
| `to` | `string | Object` | The target link of the step. The type is the same as the [`to` ](./link#props-to ) prop of [`Link` ](./link ) component. |
2020-08-13 11:47:56 +08:00
| `status` | `string` | The statue of the step. Available variants are default normal and `error` . |
+++
^^^
### Slots
| Name | Description |
| -- | -- |
2021-10-20 01:11:27 +08:00
| ``default`` | [^slot-default] |
| ``index`` | The step index. Displays an index value starts from `1` , a success icon for finished steps by default and an error icon for error steps. Resides inside the [`default` ](#slots-default ) slot and share the same scope properties. |
| ``label`` | The step label. Displays the `label` property by default. Resides inside the [`default` ](#slots-default ) slot and share the same scope properties. |
| ``desc`` | The step description. Displays the `desc` property by default. Resides inside the [`default` ](#slots-default ) slot and share the same scope properties. |
2020-08-13 11:47:56 +08:00
2020-12-22 16:33:30 +08:00
^^^slot-default
2020-08-13 11:47:56 +08:00
The content of each step. Displays the step index/completed icon, label and description by default.
+++Scope properties
| Name | Type | Description |
| -- | -- | -- |
2021-10-20 01:11:27 +08:00
| `label` | `string` | The label of the step. Same as the `label` property from items of the [`steps` ](#props-steps ) prop. |
| `desc` | `string` | The description of the step. Same as the `desc` property from items of the [`steps` ](#props-steps ) prop. |
| `to` | `string | Object` | The target link of the step. Same as the `to` property from items of the [`steps` ](#props-steps ) prop. |
| `status` | `string` | The status of the step. Same as the `status` property from items of the [`steps` ](#props-steps ) prop. |
2020-08-13 11:47:56 +08:00
| `index` | `number` | The index of the step. (Starts from `0` .) |
Additionally, custom properties in current step, apart from the listed ones, will also be passes into the scope object via `v-bind` .
+++
^^^
### Events
| Name | Description |
| -- | -- |
2021-10-20 01:11:27 +08:00
| ``click`` | Triggered when any step is clicked. The callback parameter type is `(index: number, event: Event)` , where `index` is the index of the clicked step and `event` is the corresponding native event object. |
2020-08-13 11:47:56 +08:00
### Icons
| Name | Description |
| -- | -- |
2021-10-20 01:11:27 +08:00
| ``success`` | Steps finished successfully. |
| ``error`` | Steps with error. |