展示类 · UserGuide
用户引导
用于页面对新用户进行功能引导

代码演示

如何引入

基本用法

主题

popup 气泡卡片模式下提供两种主题 default 和 primary,通过 theme 属性设置。

气泡卡片弹出位置

popup 气泡卡片模式下提供 12 种弹出位置,可选值有top, topLeft, topRight, left, leftTop, leftBottom, right, rightTop, rightBottom, bottom, bottomLeft, bottomRight,还可以通过 showArrow 属性设置是否显示箭头。

设置高亮区域大小

通过 spotlightPadding 属性设置。

定制按钮

通过 nextButtonProps 和 prevButtonProps 属性设置按钮的样式。

受控

通过 current 属性设置当前引导步骤。

弹窗式引导

通过 mode 属性设置为 modal 开启弹窗式引导。

无遮罩

通过 mask 属性设置为 false 开启无遮罩引导。

API 参考


属性说明类型默认值版本
className自定义类名string-
current当前步骤的索引number0
finishText最后一步完成按钮的文本string'完成'
mask是否显示蒙层booleantrue
mode引导模式,可选值:popup(气泡卡片)或 modal(弹窗式)stringpopup
nextButtonProps下一步按钮的属性ButtonProps{}
onChange步骤改变时的回调function(current: number)() => void
onFinish完成所有步骤时的回调function()() => void
onNext点击下一步按钮时的回调function(current: number)() => void
onPrev点击上一步按钮时的回调function(current: number)() => void
onSkip点击跳过按钮时的回调function()() => void
position弹出层相对于目标元素的位置,可选值:top, topLeft, topRight, left, leftTop, leftBottom, right, rightTop, rightBottom, bottom, bottomLeft, bottomRightstringbottom
prevButtonProps上一步按钮的属性ButtonProps{}
showPrevButton是否显示上一步按钮booleantrue
showSkipButton是否显示跳过按钮booleantrue
spotlightPadding高亮区域的内边距,单位为像素number-
steps引导步骤配置,必填StepItem[][]
style自定义样式React.CSSProperties-
theme主题样式,可选值:default 或 primarystringdefault
visible是否显示引导booleanfalse
getPopupContainer指定父级 DOM,弹层将会渲染至该 DOM 中() => HTMLElement-
zIndex弹层层级number1030

Steps.Step

属性说明类型默认值版本
className步骤的自定义类名string-
cover步骤的封面图ReactNode-
target目标元素,高亮区域会聚焦到这个元素上(() => Element) | Element-
title步骤标题string | ReactNode-
description步骤描述ReactNode-
mask是否显示此步骤的蒙层,会覆盖全局配置boolean-
showArrow是否显示箭头(仅在 mode=popup 时有效)booleantrue
spotlightPadding此步骤高亮区域区域的内边距,会覆盖全局配置number-
theme此步骤的主题,会覆盖全局配置default | primary-
position此步骤弹出层的位置,会覆盖全局配置Position-

设计变量