Tour

A popup component for guiding users through a product.
Importimport{ Tour }from"antd";
Versionsupported since 5.0.0

When To Use

Use when you want to guide users through a product.

Examples

The most basic usage.

CodeSandbox Icon
codepen icon
External Link Icon
expand codeexpand code

Change the placement of the guide relative to the target, there are 12 placements available. When target={null} the guide will show in the center.

CodeSandbox Icon
codepen icon
External Link Icon
expand codeexpand code

Custom indicator.

CodeSandbox Icon
codepen icon
External Link Icon
expand codeexpand code

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

CodeSandbox Icon
codepen icon
External Link Icon
expand codeexpand code

Custom mask style.

CodeSandbox Icon
codepen icon
External Link Icon
expand codeexpand code
Radius:
offset:
Horizontal offset:
Vertical offset:

Using gap to control the radius of highlight area and the offset between highlight area and the element.

  • Setting offset in two directions individually and offset with array type is not supported until 5.9.0.
CodeSandbox Icon
codepen icon
External Link Icon
expand codeexpand code

API

Common props ref:Common props

Tour

PropertyDescriptionTypeDefaultVersion
arrowWhether to show the arrow, including the configuration whether to point to the center of the elementboolean|{ pointAtCenter: boolean}true
closeIconCustomize close iconReact.ReactNodetrue5.9.0
disabledInteractionDisable interaction on highlighted area.booleanfalse5.13.0
gapControl the radius of the highlighted area and the offset between highlighted area and the element.{ offset?: number | [number, number]; radius?: number }{ offset?: 6 ; radius?: 2 }5.0.0 (array type offset: 5.9.0)
placementPosition of the guide card relative to the target elementcenter left leftTop leftBottom right rightTop rightBottom top topLeft topRight bottom bottomLeft bottomRightbottom
onCloseCallback function on shutdownFunction-
maskWhether to enable masking, change mask style and fill color by pass custom propsboolean | { style?: React.CSSProperties; color?: string; }true
typeType, affects the background color and text colordefault primarydefault
openOpen tourboolean-
onChangeCallback when the step changes. Current is the previous step(current: number) => void-
currentWhat is the current stepnumber-
scrollIntoViewOptionssupport pass custom scrollIntoView optionsboolean | ScrollIntoViewOptionstrue5.2.0
indicatorsRendercustom indicator(current: number, total: number) => ReactNode-5.2.0
zIndexTour's zIndexnumber10015.3.0
getPopupContainerSet the rendering node of Tour floating layer(node: HTMLElement) => HTMLElementbody5.12.0

TourStep

PropertyDescriptionTypeDefaultVersion
targetGet the element the guide card points to. Empty makes it show in center of screen() => HTMLElement | HTMLElement-
arrowWhether to show the arrow, including the configuration whether to point to the center of the elementboolean { pointAtCenter: boolean}true
closeIconCustomize close iconReact.ReactNodetrue5.9.0
coverDisplayed pictures or videosReactNode-
titletitleReactNode-
descriptiondescriptionReactNode-
placementPosition of the guide card relative to the target elementcenter left leftTop leftBottom right rightTop rightBottom top topLeft topRight bottom bottomLeft bottomRightbottom
onCloseCallback function on shutdownFunction-
maskWhether to enable masking, change mask style and fill color by pass custom props, the default follows the mask property of Tourboolean | { style?: React.CSSProperties; color?: string; }true
typeType, affects the background color and text colordefault primarydefault
nextButtonPropsProperties of the Next button{ children: ReactNode; onClick: Function }-
prevButtonPropsProperties of the previous button{ children: ReactNode; onClick: Function }-
scrollIntoViewOptionssupport pass custom scrollIntoView options, the default follows the scrollIntoViewOptions property of Tourboolean | ScrollIntoViewOptionstrue5.2.0

Design Token

Component TokenHow to use?
Token NameDescriptionTypeDefault Value
closeBtnSizeClose button sizenumber22
primaryNextBtnHoverBgHover background color of next button in primary typestringrgb(240,240,240)
primaryPrevBtnBgBackground color of previous button in primary typestringrgba(255,255,255,0.15)
zIndexPopupTour popup z-indexnumber1070
Global TokenHow to use?