shadcn.io is not affiliated with official shadcn/ui
Practice Keyboard Shortcuts Onboarding Block for React
A code review tool's shortcut sheet you can practise on: a table of six shortcuts that tick off as you press them while focus is inside the panel, a chord with a waiting state, and a Command or Ctrl switch.
Installation
Overview
Teach the shortcuts by letting people press them, with this practice panel for React with Base UI. It is a setup panel of Diffwick, a code review tool: a framed table of six shortcuts, each with its keys in Kbd and a word for whether you have tried it, a count (“2 of 6 tried”) with a hairline of progress, and a practice box at the foot. While focus is anywhere inside the panel, pressing a shortcut ticks its row and says so; Go to your inbox is a chord, G then I, so G waits for a moment. Command shows first on a Mac and Ctrl elsewhere, decided after the page loads, and a Switch at the top overrides it. On a phone each row becomes a short list with the keys under the action. There is no Shine Button: the practice is the whole point.
FAQ
Where does it listen for keys?
Only inside the panel. A capture listener on the panel's own element hears keys pressed while focus is in it (a button can't swallow one), and nothing is bound to the page, so the shortcuts never fight the rest of your site. The practice box takes focus on a click or a Tab; the box says so, and it also says that keys outside the panel are ignored.
Which shortcuts are used, and why those?
J, K, C, slash, G then I, and Command or Ctrl with Enter: keys the browser doesn't reserve. Command or Ctrl plus S, N, T or W would be taken by the browser before the page saw them, so they are left out. Edit SHORTCUTS for your own list; a chord is a shortcut with two steps, and a step can ask for Command or Ctrl with mod.
How does the chord work?
The first key (G) moves the row to “Waiting” and says what to press next. The second key (I) completes it. Any other key goes back to being a first key, and if nothing follows within a second and a half, the wait ends and the status says so. The timer is cleared when the panel unmounts.
How do Command and Ctrl get chosen?
The panel renders Command first so the server and the browser agree, then after it loads switches to Ctrl on any system that isn't a Mac or an iPhone. The switch overrides that either way, and a shortcut counts only with the modifier that is showing.
What stays local in the demo, and how do I wire it?
The ticks live in the panel's state and nothing is saved, sent or bound for real: the shortcuts do nothing in the demo but tick. In your app bind the same combinations where they act (the review page) and remember which ones a person has tried if you want the count to persist.
Related
- Pro
Keyboard Shortcuts Settings
Appearance and localeA keyboard shortcuts editor: twelve editor actions in three groups with their keys in Kbd caps, a Change button that records the next combination, a conflict check with Replace or Cancel, Changed marks and Reset, a search and a PC or Mac choice for the key words.
- Pro
A markdown notes app with its keyboard shortcuts sheet shown open: 16 shortcuts in three columns drawn as keycaps, a Mac and Windows switch that rewrites the caps, a search, and a key tester that names any chord you press.
- ⌘⌘?Pro
Keyboard Shortcuts Command Menu
Actions and keysA task app's shortcut sheet as a command menu shown open as a help popover at the corner: a Mac or Windows switch re-labels every key cap, groups fold from their heads, search filters by action name, and a button really copies the list as a Markdown table.
- Pro
Guided Walkthrough Onboarding
Welcome and toursA learn-by-doing walkthrough in a framed window: a drawn design-review app beside a docked guide of four tasks, where the control for the current task is ringed and doing it, by click or by key, opens the next.
- Pro
Product Tour Onboarding
Welcome and toursA four-stop product tour over a drawn analytics dashboard: a coachmark points at the metrics, the segments, the report and the settings one at a time, with the part lit and the rest dimmed, and a Replay tour button that starts the real Tour.
- Pro
Setup Checklist Onboarding
ChecklistsA contract tool's get-started guide as a setup panel: six steps in a single-open accordion with one button in the open step, a count that follows what you finish, a menu that hides completed steps or the guide, and a pill that opens it again.