Back to Ant Design

Tour

components/tour/index.en-US.md

6.3.75.0 KB
Original Source

When To Use

Use when you want to guide users through a product.

Examples

<!-- prettier-ignore -->

<code src="./demo/basic.tsx">Basic</code> <code src="./demo/non-modal.tsx">Non-modal</code> <code src="./demo/placement.tsx">Placement</code> <code src="./demo/mask.tsx">Custom mask style</code> <code src="./demo/indicator.tsx">Custom indicator</code> <code src="./demo/actions-render.tsx" version="5.25.0">Custom action</code> <code src="./demo/gap.tsx">Custom highlighted area style</code> <code src="./demo/style-class.tsx" version="6.0.0">Custom semantic dom styling</code> <code src="./demo/render-panel.tsx" debug>_InternalPanelDoNotUseOrYouWillBeFired</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
classNamesCustomize class for each semantic structure inside the component. Supports object or function.Record<SemanticDOM, string> | (info: { props })=> Record<SemanticDOM, string>-
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)
keyboardWhether to enable keyboard shortcutsbooleantrue6.2.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
stylesCustomize inline style for each semantic structure inside the component. Supports object or function.Record<SemanticDOM, CSSProperties> | (info: { props })=> Record<SemanticDOM, CSSProperties>-
indicatorsRendercustom indicator(current: number, total: number) => ReactNode-5.2.0
actionsRendercustom action(originNode: ReactNode, info: { current: number, total: number }) => ReactNode-5.25.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

Semantic DOM

<code src="./demo/_semantic.tsx" simplify="true"></code>

Design Token

<ComponentTokenTable component="Tour"></ComponentTokenTable>