VOOZH about

URL: https://ant.design/components/tour/

⇱ Tour - Ant Design


TooltipTree
👁 loading

When To Use

Use when you want to guide users through a product.

Examples

API

Common props ref:Common props

Tour

PropertyDescriptionTypeDefaultVersionGlobal Config
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>-6.0.0
closeIconCustomize close iconReact.ReactNodetrue5.9.05.14.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-×
onFinishCallback when the tour is finishedFunction-×
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>-6.0.0
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

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?
Token NameDescriptionTypeDefault Value
colorBgElevatedContainer background color of the popup layer, in dark mode the color value of this token will be a little brighter than `colorBgContainer`. E.g: modal, pop-up, menu, etc.string#ffffff
colorBgTextActiveControl the background color of text in active state.stringrgba(0,0,0,0.15)
colorBgTextHoverControl the background color of text in hover state.stringrgba(0,0,0,0.06)
colorFillThe darkest fill color is used to distinguish between the second and third level of fill color, and is currently only used in the hover effect of Slider.stringrgba(0,0,0,0.15)
colorIconWeak action. Such as `allowClear` or Alert close buttonstringrgba(0,0,0,0.45)
colorIconHoverWeak action hover color. Such as `allowClear` or Alert close buttonstringrgba(0,0,0,0.88)
colorPrimaryBrand color is one of the most direct visual elements to reflect the characteristics and communication of the product. After you have selected the brand color, we will automatically generate a complete color palette and assign it effective design semantics.string#1677ff
colorPrimaryBorderThe stroke color under the main color gradient, used on the stroke of components such as Slider.string#91caff
colorTextDefault text color which comply with W3C standards, and this color is also the darkest neutral color.stringrgba(0,0,0,0.88)
colorTextLightSolidControl the highlight color of text with background color, such as the text in Primary Button components.string#fff
colorWhitePure white color don't changed by themestring#fff
borderRadiusBorder radius of base componentsnumber6
borderRadiusLGLG size border radius, used in some large border radius components, such as Card, Modal and other components.number8
borderRadiusSMSM size border radius, used in small size components, such as Button, Input, Select and other input components in small sizenumber4
borderRadiusXSXS size border radius, used in some small border radius components, such as Segmented, Arrow and other components with small border radius.number2
boxShadowTertiaryControl the tertiary box shadow style of an element.string 0 1px 2px 0 rgba(0,0,0,0.05), 0 1px 6px -1px rgba(0,0,0,0.03), 0 2px 4px 0 rgba(0,0,0,0.03)
fontFamilyThe font family of Ant Design prioritizes the default interface font of the system, and provides a set of alternative font libraries that are suitable for screen display to maintain the readability and readability of the font under different platforms and browsers, reflecting the friendly, stable and professional characteristics.string-apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, 'Noto Sans', sans-serif, 'Apple Color Emoji', 'Segoe UI Emoji', 'Segoe UI Symbol', 'Noto Color Emoji'
fontSizeThe most widely used font size in the design system, from which the text gradient will be derived.number14
fontWeightStrongControl the font weight of heading components (such as h1, h2, h3) or selected item.number600
lineHeightLine height of text.number1.5714285714285714
lineWidthFocusControl the width of the line when the component is in focus state.number3
marginXSControl the margin of an element, with a small size.number8
motionDurationMidMotion speed, medium speed. Used for medium element animation interaction.string0.2s
motionDurationSlowMotion speed, slow speed. Used for large element animation interaction.string0.3s
paddingControl the padding of the element.number16
paddingXSControl the extra small padding of the element.number8
sizePopupArrowThe size of the component arrownumber16
Basic

The most basic usage.

Placement

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.

Custom indicator

Custom indicator.

Custom highlighted area style

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.
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.

Custom mask style

Custom mask style.

Custom action.

5.25.0

You can customize the semantic dom style of Tour by passing objects/functions through classNames and styles.

6.0.0
Radius:
offset:
Horizontal offset:
Vertical offset:
  • root
    6.0.0
    Tour root container with absolute positioning, z-index control, max width, visibility, arrow background color variable, theme styles and other container styles
  • mask
    6.0.0
    Mask layer element with fixed positioning, full screen coverage, z-index, pointer events, transition animation and other mask styles
  • section
    6.0.0
    Card main content area with text alignment, border radius, box shadow, relative positioning, background color, border, background clip and other card styles
  • cover
    6.0.0
    Card cover area with text center alignment, padding, image width and other image display styles
  • close
    6.4.0
    Close button element with absolute positioning, size, color, hover state and other interactive feedback styles
  • header
    6.0.0
    Card header area with padding, width calculation, word break and other header container styles
  • title
    6.0.0
    Guide title text with font weight and other title text styles
  • description
    6.0.0
    Guide description text with padding, word wrap and other description text styles
  • footer
    6.0.0
    Card bottom action area with padding, text right alignment, border radius, flex layout and other bottom container styles
  • actions
    6.0.0
    Action button group container with left auto margin, button spacing and other button group layout styles
  • indicators
    6.0.0
    Indicator group container with inline-block display and other indicator container styles
  • indicator
    6.0.0
    Single indicator element with width/height size, inline-block display, border radius, background color, right margin, active state and other dot styles