Back to Element Plus

Tour

docs/en-US/component/tour.md

2.13.713.7 KB
Original Source

Tour

A popup component for guiding users through a product. Use when you want to guide users through a product.

Basic usage

The most basic usage

:::demo

tour/basic

:::

Non modal

Use :mask="false" to make Tour non-modal. At the meantime it is recommended to use with type="primary" to emphasize the guide itself.

:::demo

tour/non-modal

:::

Placement

Change the placement of the guide relative to the target, there are 12 placements available. When target is empty the guide will show in the center.

:::demo

tour/placement

:::

Custom mask style

Custom mask style.

:::demo

tour/mask

:::

Custom indicator

Custom indicator.

:::demo

tour/indicator

:::

Target

Various parameter passing types of target. The string and Function types are supported since ^(2.5.2).

:::demo

tour/target

:::

Tour API

:::tip tour-step component configuration with the same name has higher priority :::

Tour Attributes

PropertyDescriptionTypeDefault
append-towhich element the TourContent appends to^[CSSSelector] / ^[HTMLElement]body
show-arrowwhether to show the arrowbooleantrue
placementposition of the guide card relative to the target element^[enum]'top' | 'top-start' | 'top-end' | 'bottom' | 'bottom-start' | 'bottom-end' | 'left' | 'left-start' | 'left-end' | 'right' | 'right-start' | 'right-end'bottom
content-stylecustom style for contentCSSProperties
maskwhether to enable masking, change mask style and fill color by pass custom propsboolean | ^[Object]{ style?: CSSProperties; color?: string; }true
gaptransparent gap between mask and targetTourGap^[Object]{ offset: 6, radius: 2}
typetype, affects the background color and text colordefault | primarydefault
model-value / v-modelopen tourbooleanfalse
current / v-model:currentwhat is the current stepnumber0
scroll-into-view-optionssupport pass custom scrollIntoView optionsboolean | ScrollIntoViewOptions^[Object]{ block: 'center' }
z-indexTour's zIndexnumber2001
show-closewhether to show a close buttonbooleantrue
close-iconcustom close icon, default is Closestring | Component
close-on-press-escapewhether the Dialog can be closed by pressing ESCbooleantrue
target-area-clickablewhether the target element can be clickable, when using maskbooleantrue

Tour slots

NameDescriptionType
defaulttourStep component list
indicatorscustom indicator^[object]{ current: number, total: number }

Tour events

NameDescriptionType
closecallback function on shutdown^[Function](current: number) => void
finishcallback function on finished^[Function]() => void
changecallback when the step changes^[Function](current: number) => void

TourStep API

TourStep Attributes

PropertyDescriptionTypeDefault
targetget the element the guide card points to. Empty makes it show in center of screen. the string and Function types are supported since ^(2.5.2). the string type is selectors of document.querySelector.HTMLElement | string | ^[Function]() => HTMLElement
show-arrowwhether to show the arrowboolean
titletitlestring
descriptiondescriptionstring
placementposition of the guide card relative to the target element^[enum]'top' | 'top-start' | 'top-end' | 'bottom' | 'bottom-start' | 'bottom-end' | 'left' | 'left-start' | 'left-end' | 'right' | 'right-start' | 'right-end'bottom
content-stylecustom style for contentCSSProperties
maskwhether to enable masking, change mask style and fill color by pass custom propsboolean | ^[Object]{ style?: CSSProperties; color?: string; }
typetype, affects the background color and text colordefault | primarydefault
next-button-propsproperties of the Next button^[Object]{ children: VueNode | string; onClick: Function }
prev-button-propsproperties of the previous button^[Object]{ children: VueNode | string; onClick: Function }
scroll-into-view-optionssupport pass custom scrollIntoView options, the default follows the scrollIntoViewOptions property of Tourboolean | ScrollIntoViewOptions
show-closewhether to show a close buttonboolean
close-iconcustom close icon, default is Closestring | Component

TourStep slots

NameDescription
defaultcustom description
headercustom header content

TourStep events

NameDescriptionArguments
closecallback function on shutdown^[Function]() => void