Mỗi ví dụ là một file Vue hoàn chỉnh. Chép vào ứng dụng đã cài registry, hoặc mở trong StackBlitz.
Trình hướng dẫn thiết lập
Bước đã xong có dấu tích, nên trạng thái không chỉ bằng màu.
Step 2 of 0
StepperWizard.vue
<script setup lang="ts">
import { Check } from '@lucide/vue'
import { ref } from 'vue'
import { Button } from '@/components/ui/button'
import {
Stepper,
StepperDescription,
StepperIndicator,
StepperItem,
StepperSeparator,
StepperTitle,
StepperTrigger,
} from '@/components/ui/stepper'
const steps = [
{ step: 1, title: 'Kết nối cửa hàng', description: 'Đăng nhập vào cửa hàng online' },
{ step: 2, title: 'Map trường', description: 'Ghép các trường đơn hàng với ERP' },
{ step: 3, title: 'Lịch chạy', description: 'Chọn tần suất đồng bộ' },
]
const current = ref(2)
</script>
<template>
<div class="flex w-full flex-col gap-(--bh-space-300)">
<Stepper v-model="current" aria-label="Thiết lập đồng bộ đơn hàng" class="w-full">
<StepperItem
v-for="item in steps"
:key="item.step"
v-slot="{ state }"
:step="item.step"
class="relative flex-1 flex-col items-center"
>
<StepperSeparator
v-if="item.step !== steps[steps.length - 1].step"
class="absolute top-[calc(var(--bh-space-050)+var(--bh-size-control-default)/2)] left-[calc(50%+var(--bh-size-control-default))] right-[calc(-50%+var(--bh-size-control-default))]"
/>
<StepperTrigger>
<StepperIndicator>
<Check v-if="state === 'completed'" aria-hidden="true" />
<span v-else>{{ item.step }}</span>
</StepperIndicator>
<StepperTitle>{{ item.title }}</StepperTitle>
<StepperDescription>{{ item.description }}</StepperDescription>
</StepperTrigger>
</StepperItem>
</Stepper>
<!-- Nút của wizard nằm bên phải, thao tác chính ở cuối (D10). -->
<div class="flex justify-end gap-(--bh-space-100)">
<Button variant="outline" :disabled="current === 1" @click="current--">Quay lại</Button>
<Button v-if="current < steps.length" @click="current++">Tiếp tục</Button>
<Button v-else>Bắt đầu đồng bộ</Button>
</div>
</div>
</template>Dọc, theo thứ tự
Một bước chỉ mở sau khi các bước trước xong.
Step 2 of 0
StepperVertical.vue
<script setup lang="ts">
import { Check } from '@lucide/vue'
import {
Stepper,
StepperDescription,
StepperIndicator,
StepperItem,
StepperSeparator,
StepperTitle,
StepperTrigger,
} from '@/components/ui/stepper'
// linear (mặc định): chỉ mở được một bước khi các bước trước đã xong.
const steps = [
{ step: 1, title: 'Tạo API key', description: 'Đã xong ngày 10/11/2026' },
{ step: 2, title: 'Thêm webhook', description: 'ERP gửi hóa đơn mới về đây' },
{ step: 3, title: 'Gửi sự kiện thử', description: 'Kiểm tra một hóa đơn được gửi tới' },
]
</script>
<template>
<Stepper :default-value="2" orientation="vertical" aria-label="Kết nối ERP" class="flex-col items-start">
<StepperItem
v-for="item in steps"
:key="item.step"
v-slot="{ state }"
:step="item.step"
class="relative w-full items-start"
>
<StepperSeparator
v-if="item.step !== steps[steps.length - 1].step"
class="absolute top-[calc(var(--bh-size-control-default)+var(--bh-space-100))] bottom-0 left-[calc(var(--bh-space-050)+var(--bh-size-control-default)/2)]"
/>
<StepperTrigger class="flex-row items-start text-start">
<StepperIndicator>
<Check v-if="state === 'completed'" aria-hidden="true" />
<span v-else>{{ item.step }}</span>
</StepperIndicator>
<span class="flex flex-col gap-(--bh-space-025) pb-(--bh-space-300)">
<StepperTitle>{{ item.title }}</StepperTitle>
<StepperDescription>{{ item.description }}</StepperDescription>
</span>
</StepperTrigger>
</StepperItem>
</Stepper>
</template>