Skip to content

KTour ​

A popup component for guiding users through a product.

Install ​

bash
pnpm add @ikun-ui/tour
bash
yarn add @ikun-ui/tour
bash
npm install @ikun-ui/tour

Basic usage ​

The most basic usage.

No mask layer ​

Sometimes you may not need the mask layer, you can set mask to false

Placement ​

When target=null the guide will be displayed in the center.

Tour Props ​

NameTypeDefaultDescription
maskbooleantrueWhether to enable masking.
prevBtnTextstring'prev'Previous button text.
nextBtnTextstring'next'Next button text.
placement'top' | 'left' | 'right' | 'bottom''top'Placement of tour.
openbooleanfalseOpen tour.
closeIconstringi-carbon-closeThe class name of the icon, following the unocss standard
currentnumber0What is the current step
scrollIntoViewOptionsboolean | ScrollIntoViewOptionstruesupport pass custom scrollIntoView options, the default follows the scrollIntoViewOptions property of Tour
zIndexnumber1001Tour's zIndex
stepsKTourStepsOption[][]Additional attributes
clsstring''Additional class for component
attrsany{}Additional attributes
typescript
export interface KTourStepsOption {
	// Get the element the guide card points to.
	// Empty makes it show in center of screen
	target?: Element | null;
	// title
	title?: string;
	// description
	description?: string;
}

Tour Events ​

NameDescriptionType
closeCallback function on shutdown.()=> void
finishCallback when all steps are completed.()=> void
changeCallback when the step changes. Current is the previous step.(current: number)=> void

Tour Slots ​

NameDescription
titlecontent of the title.
closeIconcontent of the title.
descriptioncontent of the description.
footercontent of the footer.
indicatorscontent of the indicators.
prevButtoncontent of the prevButton.
nextButtoncontent of the nextButton.

Title slot params ​

typescript
export interface TitleSlotPa {
	//  What is the current step
	current: number;
	// The title of the current step
	title: string;
}

Description slot params ​

typescript
export interface DescriptionSlotPa {
	//  What is the current step
	current: number;
	// The description of the current step
	description: string;
}

CloseIcon slot params ​

typescript
export interface CloseIconSlotPa {
	// Close button triggers close function
	handleClose: () => void;
}

Indicators slot params ​

typescript
export interface IndicatorsSlotPa {
	//  What is the current step
	current: number;
}

PrevButton slot params ​

typescript
export interface PrevButtonSlotPa {
	// The previous button triggers the function to go back to the previous step.
	handlePrev: () => void;
}

PrevButton slot params ​

typescript
export interface PrevButtonSlotPa {
	//  The next button triggers the function to go back to the next step.
	handleNext: () => void;
}
typescript
export interface FooterSlotPa {
	//  What is the current step
	current: number;
	// The previous button triggers the function to go back to the previous step.
	handlePrev: () => void;
	//  The next button triggers the function to go back to the next step.
	handleNext: () => void;
}

MIT Licensed