You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+12Lines changed: 12 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -51,6 +51,8 @@ const App = () => {
51
51
options: {
52
52
infoBoxHeight:220,
53
53
infoBoxMargin:24,
54
+
keyboardNavigation:true,
55
+
closeOnOverlayClick:true,
54
56
onClose: () => {
55
57
console.log('tutorial closed');
56
58
},
@@ -71,6 +73,16 @@ const App = () => {
71
73
72
74
`content` is rendered as a plain string. HTML markup in the string is not interpreted.
73
75
76
+
Keyboard navigation is enabled by default while the overlay is open:
77
+
78
+
-`Escape` closes the tutorial.
79
+
-`ArrowRight` moves to the next step and completes the tutorial on the last step.
80
+
-`ArrowLeft` moves to the previous step and is a no-op on the first step.
81
+
82
+
Set `options.keyboardNavigation` to `false` to disable those shortcuts. Shortcuts are ignored while an `input`, `textarea`, `select`, or `contenteditable` element has focus.
83
+
84
+
Set `options.closeOnOverlayClick` to `true` to close the tutorial when the dimmed backdrop itself is clicked. Clicks on the highlight frame and info box do not trigger close.
85
+
74
86
Mount `<TutorialOverlay />` once near the root of your app, then trigger `tutorial.open({ steps, options })` from any event handler or effect.
Copy file name to clipboardExpand all lines: packages/document/src/pages/docs/tutorial-overlay.mdx
+4Lines changed: 4 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -23,3 +23,7 @@ function App() {
23
23
```
24
24
25
25
`TutorialOverlay` does not need props for the current public API. Configure behavior through `tutorial.open({ steps, options })`.
26
+
27
+
By default, the mounted overlay listens for `Escape`, `ArrowLeft`, and `ArrowRight` while it is open. You can disable that with `options.keyboardNavigation = false`.
28
+
29
+
Backdrop clicks are ignored by default. Set `options.closeOnOverlayClick = true` if you want clicking the dimmed overlay area to close the tutorial.
0 commit comments