Overlays
Layout
Tour
A guided walkthrough that highlights one element at a time next to a callout. Use it for onboarding and product tours.
Install
import { Tour } from 'vael-ui'Playground
Placement, behaviour and animation
Usage
<script setup lang="ts">
import { ref } from 'vue'
import { Tour } from 'vael-ui'
const steps = [
{ target: '#first', title: 'First stop', description: 'Starts here.' },
{ target: '#second', title: 'Second stop', description: 'And ends here.' },
]
const open = ref(false)
</script>
<template>
<Tour v-model:open="open" :steps="steps" />
</template>Motion New
Tour's motion: the callout opens and closes like Popover's. Its timing, { duration, easing } or { spring }, also sets how the spotlight and the callout glide between steps. Unset, the glide is quick to a nearby target and longer across the screen. false turns it all off.
<Tour
:motion="{
initial: { panel: { opacity: 0, y: 8, scale: 0.98 } },
spring: { damping: 0.85, response: 0.35 },
}"
/>| Name | Type | Description |
|---|---|---|
initialexit | positionerpanel | Sets where each part comes in from and leaves to: any CSS property, plus x, y and blur. A plain number is px, or degrees for rotate. |
enterleave | (parts, context) => animation | Animates the parts with GSAP, motion or element.animate(). Return the animation and the component waits for it, and stops it if interrupted. |
morphlinkedexitOrder | 'trigger' | Record<string, LinkedMotion> | 'reverse' | morph: 'trigger' grows it out of the element that opened it. linked moves other elements with it, such as the page receding behind it. exitOrder: 'reverse' closes its children first. |
swapresize | 'sync' | 'wait' | boolean | Content that changes while it's open crossfades ('sync') or waits for the old view to leave ('wait'), and the box eases to its new size unless resize: false. |
springdurationeasing | { damping, response } | number | string | Times all of it: a spring, or a duration in ms with an easing. Never both. |
false | boolean | Turns its motion off, for an animation of your own on its exposed elements. |
Accessibility
| Key | Action |
|---|---|
| ArrowRight | Goes to the next step. |
| ArrowLeft | Goes to the previous step. |
| TabShiftTab | Moves focus within the callout, wrapping at the ends, when modal is on. |
| Escape | Ends the tour and fires @skip, unless closeOnEsc is false. |
- The callout has
role="dialog". Its visible title names it througharia-labelledbyand its description througharia-describedby; with a custom slot or no title, it gets anaria-labelfrom the step’stitle, else the translated “Step {current} of {total}”. Withmodal, it setsaria-modalonly when the target can’t be used (disableInteraction). - Focus moves to an
[autofocus]element in the callout on open and on every step change, else the Next button, else the first focusable element. When the tour ends, focus returns to the element that started it. - With
modal(default), everything but the target and the callout isinert, and Tab cycles through the callout, then the target’s controls. - Arrow keys are ignored while focus is in a field or a widget that uses them, and
keyboardNav: falseturns them off. Right to left, ArrowLeft and ArrowRight swap.