stepper

Stepper with vertical orientation and titles

Stepper with vertical orientation and titles

Загрузка превью…

src/stepper/c-stepper-15.vue

<script setup lang="ts">
import { Stepper, StepperContent, StepperIndicator, StepperItem, StepperNav, StepperPanel, StepperSeparator, StepperTitle, StepperTrigger } from "@/components/reui/stepper"

const steps = [{ title: "Account" }, { title: "Profile" }, { title: "Review" }]
</script>

<template>
  <div class="flex items-center justify-center">
    <Stepper
      class="flex flex-col items-center justify-center gap-10"
      :default-value="2"
      orientation="vertical"
    >
      <template #indicator-completed>
        <svg
          xmlns="http://www.w3.org/2000/svg"
          width="24"
          height="24"
          viewBox="0 0 24 24"
          fill="none"
          stroke="currentColor"
          stroke-width="2"
          stroke-linecap="round"
          stroke-linejoin="round"
          class="size-3.5"
        >
          <path d="M20 6 9 17l-5-5" />
        </svg>
      </template>
      <template #indicator-loading>
        <svg
          xmlns="http://www.w3.org/2000/svg"
          width="24"
          height="24"
          viewBox="0 0 24 24"
          fill="none"
          stroke="currentColor"
          stroke-width="2"
          stroke-linecap="round"
          stroke-linejoin="round"
          class="size-3.5 animate-spin"
        >
          <path d="M21 12a9 9 0 1 1-6.219-8.56" />
        </svg>
      </template>

      <StepperNav>
        <StepperItem
          v-for="(step, index) in steps"
          :key="index"
          :step="index + 1"
          class="relative items-start not-last:flex-1"
        >
          <StepperTrigger class="items-start gap-2.5 pb-12 last:pb-0">
            <StepperIndicator
              class="data-[state=completed]:bg-success data-[state=completed]:text-white"
            >{{ index + 1 }}</StepperIndicator>
            <div class="mt-0.5 text-left">
              <StepperTitle>{{ step.title }}</StepperTitle>
            </div>
          </StepperTrigger>
          <StepperSeparator
            v-if="index < steps.length - 1"
            class="group-data-[state=completed]/step:bg-success absolute inset-y-0 top-7 left-3 -order-1 m-0 -translate-x-1/2 group-data-[orientation=vertical]/stepper-nav:h-[calc(100%-2rem)]"
          />
        </StepperItem>
      </StepperNav>

      <StepperPanel class="w-56 text-center text-sm">
        <StepperContent v-for="(step, index) in steps" :key="index" :value="index + 1">{{ step.title }} content</StepperContent>
      </StepperPanel>
    </Stepper>
  </div>
</template>

Установка

npx shadcn-vue@latest add https://revueui.rootapi.dev/r/c-stepper-15.json

Зависимости реестра

Источник: порт из ReUI (Keenthemes, MIT)