WlSteps
Process steps. Completed steps have a check mark; the current step is highlighted.
Components / Navigation v0.1.0
Selection
orientation
Default
Step 2 of 3: Access.
Full example
<script setup lang="ts">
import { WlButton, type WlStepItem, WlSteps } from "legato-ui";
import { computed, ref } from "vue";
const current = ref(1);
const error = ref(true);
const items = computed<readonly WlStepItem[]>(() => [
{ key: "data", label: "Data", description: "Add the title and main details." },
{ key: "access", label: "Access", description: "Choose who can read the material.", error: error.value },
{ key: "review", label: "Review", description: "Review the result before saving." }
]);
</script>
<template>
<div class="wl-stack" data-space="lg">
<WlSteps
v-model:current="current"
:items="items"
clickable
aria-label="Material preparation steps"
/>
<WlSteps
v-model:current="current"
:items="items"
clickable
orientation="vertical"
aria-label="Material preparation, vertical layout"
/>
<div class="wl-inline" data-space="sm">
<WlButton size="sm" :disabled="current === 0" @click="current--">{{ "Previous step" }}</WlButton>
<WlButton size="sm" :disabled="current === items.length - 1" @click="current++">{{ "Next step" }}</WlButton>
<WlButton size="sm" variant="ghost" @click="error = !error">{{ "Toggle access error" }}</WlButton>
<WlButton size="sm" variant="ghost" @click="current = 0; error = true">{{ "Start over" }}</WlButton>
</div>
<p class="wl-text-small" role="status">
{{ "Step" }} {{ current + 1 }} {{ "of" }} {{ items.length }}: {{ items[current]?.label }}.
</p>
</div>
</template>Completed, current and future steps
Clickable steps with controlled current state, descriptions, errors, horizontal/vertical keyboard navigation, back/next and restarting.
Step 2 of 3: Access.
Full example
<script setup lang="ts">
import { WlButton, type WlStepItem, WlSteps } from "legato-ui";
import { computed, ref } from "vue";
const current = ref(1);
const error = ref(true);
const items = computed<readonly WlStepItem[]>(() => [
{ key: "data", label: "Data", description: "Add the title and main details." },
{ key: "access", label: "Access", description: "Choose who can read the material.", error: error.value },
{ key: "review", label: "Review", description: "Review the result before saving." }
]);
</script>
<template>
<div class="wl-stack" data-space="lg">
<WlSteps
v-model:current="current"
:items="items"
clickable
aria-label="Material preparation steps"
/>
<WlSteps
v-model:current="current"
:items="items"
clickable
orientation="vertical"
aria-label="Material preparation, vertical layout"
/>
<div class="wl-inline" data-space="sm">
<WlButton size="sm" :disabled="current === 0" @click="current--">{{ "Previous step" }}</WlButton>
<WlButton size="sm" :disabled="current === items.length - 1" @click="current++">{{ "Next step" }}</WlButton>
<WlButton size="sm" variant="ghost" @click="error = !error">{{ "Toggle access error" }}</WlButton>
<WlButton size="sm" variant="ghost" @click="current = 0; error = true">{{ "Start over" }}</WlButton>
</div>
<p class="wl-text-small" role="status">
{{ "Step" }} {{ current + 1 }} {{ "of" }} {{ items.length }}: {{ items[current]?.label }}.
</p>
</div>
</template>Props
Types, accepted values and literal defaults come from the public manifest. Inherited settings name their source; “Not set” means no default is declared.
| Prop | Type / values | Default | Purpose |
|---|---|---|---|
items | readonly WlStepItem[] | [] | WlStepItem[]: { label }. |
current | number | 0 | Current step index, starting at 0. |
clickable | boolean | Not set | Enable step buttons and keyboard navigation, skipping disabled items. |
orientation | "horizontal" | | Not set | Layout and arrow-key direction for interactive steps. |
Events
| Event | Payload | When emitted |
|---|---|---|
update:current | [index: number] | Requests a new zero-based current step index. |
Slots
| Slot | Type / values | Content |
|---|---|---|
step | step?(props: { item: WlStepItem; index: number; current: boolean; completed: boolean }): unknown; | Custom step content with its index, current and completed states. |
Keyboard and accessibility
- Current is a zero-based index; the current item receives aria-current=step.
- The indicator is not a set of buttons: implement back/next as separate named application actions.
- Describe the current step in text, check index limits, and do not convey completion through colour or a check mark alone.
Keyboard and application responsibilities
| Key | Action |
|---|---|
| Tab | Enter or leave the group through one active focus stop. |
| ← / → or ↑ / ↓ | Move in the configured orientation and skip disabled items. |
| Home / End | Focus the first or last enabled item. |
| Enter / Space | Activate the focused action. Tabs, radios and segmented choices select as documented. |
Provide a meaningful accessible name and connect labels, hints and errors to the focusable element. Check the behavior with your own data and a screen reader.
WAI-ARIA Authoring PracticesIn your application, check keyboard controls, zoom and focus visibility. State labels and required information must be readable in every theme.