Skip to content

Tour ​

Компонент пошагового гида, который подсвечивает элементы на странице и показывает пошаговые инструкции. Отлично подходит для онбординга, знакомства с функциями и обучающих туров.

Basic ​

Нажмите «Start Tour», чтобы пройти по подсвеченным элементам с плавными переходами.

vue
<script setup>
import { ref } from 'vue'
import { VxTour, VxButton, VxInput } from 'veloxui'

const showTour = ref(false)
const steps = [
  {
    target: '#dashboard-btn',
    title: 'Dashboard',
    description: 'Access your main dashboard with key metrics.',
  },
  {
    target: '#settings-btn',
    title: 'Settings',
    description: 'Configure your preferences and security options.',
  },
  {
    target: '#search-input',
    title: 'Search',
    description: 'Find anything across your workspace.',
  },
]
</script>

<template>
  <VxButton id="dashboard-btn" type="primary">Dashboard</VxButton>
  <VxButton id="settings-btn">Settings</VxButton>
  <VxInput id="search-input" placeholder="Search..." />

  <VxButton @click="showTour = true">Start Tour</VxButton>
  <VxTour v-model="showTour" :steps="steps" />
</template>

Placement ​

Управляйте положением поповера на каждом шаге через опцию placement: top, bottom, left или right. Если не указано, лучшая позиция определяется автоматически.

vue
<script setup>
import { ref } from 'vue'
import { VxTour, VxButton } from 'veloxui'

const showTour = ref(false)
const steps = [
  { target: '#btn-top', title: 'Top', description: 'Popover above.', placement: 'top' },
  { target: '#btn-right', title: 'Right', description: 'Popover to the right.', placement: 'right' },
  { target: '#btn-bottom', title: 'Bottom', description: 'Popover below.', placement: 'bottom' },
  { target: '#btn-left', title: 'Left', description: 'Popover to the left.', placement: 'left' },
]
</script>

<template>
  <VxButton id="btn-top">Top</VxButton>
  <VxButton id="btn-right">Right</VxButton>
  <VxButton id="btn-bottom">Bottom</VxButton>
  <VxButton id="btn-left">Left</VxButton>
  <VxButton @click="showTour = true">Start Tour</VxButton>
  <VxTour v-model="showTour" :steps="steps" />
</template>

Connected Cards ​

Указывайте карточные элементы интерфейса, чтобы провести пользователя через сложные макеты.

Create Project
Start something new
Team Settings
Manage members
Analytics
View insights
vue
<script setup>
import { ref } from 'vue'
import { VxTour, VxButton } from 'veloxui'

const showTour = ref(false)
const steps = [
  { target: '#create-card', title: 'Create Project', description: 'Start a new project.' },
  { target: '#team-card', title: 'Team Settings', description: 'Manage your team.' },
  { target: '#analytics-card', title: 'Analytics', description: 'View performance insights.' },
]
</script>

<template>
  <div id="create-card">...</div>
  <div id="team-card">...</div>
  <div id="analytics-card">...</div>
  <VxButton @click="showTour = true">Start Tour</VxButton>
  <VxTour v-model="showTour" :steps="steps" />
</template>

Custom Content ​

Используйте слот по умолчанию, чтобы полностью настроить содержимое каждого шага. Слот получает step, index, total, next, prev и close.

vue
<script setup>
import { ref } from 'vue'
import { VxTour, VxButton } from 'veloxui'

const showTour = ref(false)
const steps = [
  { target: '#home', title: 'Welcome!', description: 'Let us show you around.' },
  { target: '#actions', title: 'Quick Actions', description: 'Access frequent actions here.' },
]
</script>

<template>
  <VxTour v-model="showTour" :steps="steps">
    <!-- Custom step content via default slot -->
    <template #default="{ step, index, total, next, prev, close }">
      <div style="display: flex; align-items: center; gap: 10px; margin-bottom: 8px;">
        <span class="step-badge">{{ index + 1 }}</span>
        <span class="step-title">{{ step?.title }}</span>
      </div>
      <p>{{ step?.description }}</p>
    </template>
  </VxTour>
</template>

Keyboard Navigation ​

Тур поддерживает навигацию с клавиатуры из коробки:

  • Arrow Right / Down — Следующий шаг
  • Arrow Left / Up — Предыдущий шаг
  • Escape — Закрыть тур

API ​

VxTour Props ​

PropTypeDefaultDescription
v-modelbooleanfalseУправляет видимостью тура
stepsTourStep[][]Массив описаний шагов
currentnumber0Индекс текущего шага
maskClosablebooleantrueЗакрывать тур по клику на тёмную подложку
showSkipbooleantrueПоказывать кнопку «Skip»
paddingnumber10Отступ вокруг подсвеченного элемента (px)
scrollIntoViewbooleantrueАвтопрокрутка цели в область видимости

TourStep ​

PropertyTypeRequiredDescription
targetstring | () => HTMLElementYesCSS-селектор или функция, возвращающая целевой элемент
titlestringNoЗаголовок шага
descriptionstringNoТекст описания шага
placement'top' | 'bottom' | 'left' | 'right'NoПозиция поповера (автоопределение при отсутствии)

Events ​

EventPayloadDescription
update:modelValuebooleanСостояние открытия/закрытия тура изменилось
update:currentnumberИндекс текущего шага изменён
changenumberШаг изменился (новый индекс)
finish—Пользователь нажал «Finish» на последнем шаге
skip—Пользователь нажал «Skip»

Slots ​

SlotPropsDescription
default{ step, index, total, isFirst, isLast, next, prev, close }Пользовательское содержимое шага
footer{ index, total, isFirst, isLast, next, prev, close }Пользовательский футер (заменяет точки и кнопки навигации)