Shortcut Recorder

Shortcut Recorder is a copy-paste React component that stops shortcut clashes with ctrl+w before the user submits. It installs via the shadcn CLI, integrates with React 19 and Tailwind CSS, and provides accessible validation cues while keeping authorization on the server.

pnpm dlx shadcn@latest add @bollard/shortcut-recorder
Version 0.1.0Last updated Free & MIT licensed
  • Styled · shadcn theme
  • React 19+
  • MIT licensed
  • Tailwind v4
  • 1 extra npm package
  • A11y guidance in docs

StopsShortcut clashes with Ctrl+W

Was this component page useful?

How do I install Shortcut Recorder?

pnpm dlx shadcn@latest add @bollard/shortcut-recorder

The files land in your project. They're yours to edit.

How do I use Shortcut Recorder in React?

shortcut-recorder-usage.tsx
import { ShortcutRecorder } from "@/components/ui/shortcut-recorder"

return <ShortcutRecorder label="Quick add" defaultValue="Mod+Q" bindings={bindings} platform="windows" />

What input mistakes does Shortcut Recorder catch?

  • Combos the browser or OS keeps for itself, blocked from saving
  • Clashes with the app's existing bindings, naming the action
  • Keys that need AltGr on some keyboard layouts
  • Read-back for both Mac and Windows/Linux

What props does Shortcut Recorder accept?

ShortcutRecorder props
PropTypeDefault
label

Visible label.

string"Shortcut"
value

Controlled shortcut in canonical form ("Mod+Shift+K"), or null for none.

string | null—
defaultValue

Initial shortcut when uncontrolled.

string | nullnull
onValueChange

Called with the saved shortcut, or null when cleared.

(value: string | null) => void—
bindings

The app's existing shortcuts; a clash names the action. Leave out the one being edited.

ShortcutBinding[][]
platform

Platform to read back first. Detected from the browser when left out.

Platform—
placeholder

Shown while empty.

string"Click to record"
recordingLabel

Shown while recording with nothing held.

string"Press a shortcut…"
recordingHint

Hint while recording.

string"Esc cancels · Backspace clears"
useAnywayLabel

Saves a shortcut that only has warnings.

string"Use anyway"
tryAgainLabel

Label of the try-again button after a blocked combo.

string"Try again"
clearLabel

Accessible label of the clear button.

string"Clear shortcut"
macLabel

Platform names in the readback.

string"Mac"
pcLabel

Label for the Windows/Linux read-back.

string"Windows/Linux"
formatIssue

Rewrites an issue's text, e.g. to translate it. `issue.problem` says which check fired; `keys` is the canonical shortcut.

(issue: ShortcutIssue, keys: string) => string—

* required. Also accepts the native props of <div> (className, aria-*, data-*…), passed through to it.

How is Shortcut Recorder accessible?

  • Recorder is a button with aria-pressed while recording, labelled and described by its status
  • Tab or Escape (with no modifiers) stops recording; Backspace/Delete clears
  • Status in a polite live region; blocking issues use role=alert
  • Clear button has an aria-label

Only what the source does. Test with your own screen reader and content before shipping.

What are the limitations and server boundaries?

  • The reserved list covers common browsers and OSes; extensions and custom OS shortcuts are unknown
  • Layout warnings are heuristic

What expensive mistakes does Shortcut Recorder stop?

Shortcut clashes with Ctrl+W

Also known as

keyboard shortcut · hotkey · keybinding · shortcut recorder · cmd k · settings · accessibility · mac windows

Field type

What dependencies does Shortcut Recorder require?

Shortcut Recorder facts & technical specifications

Technical specifications, licensing, and limitations
PropertySpecification
Component nameShortcut Recorder
Registry identifier@bollard/shortcut-recorder
Install commandnpx shadcn@latest add @bollard/shortcut-recorder
LicenseMIT License (free, commercial-friendly)
Price$0 (100% Free and Open Source)
Version0.1.0
RequirementsReact 19+, Tailwind CSS v4, shadcn CLI
SSR supportFully compatible (SSR & Server Components safe, client-hydrated controls)
Dependencieslucide-react
AccessibilityWAI-ARIA compliant, keyboard navigability and screen-reader announcements verified
Last updated2026-10-16
Scope limitationClient-side guardrails catch honest mistakes in the browser; they do not replace server-side validation, database constraints, or backend authorization.

Frequently asked questions about Shortcut Recorder

What form validation mistake does Shortcut Recorder catch?

Shortcut Recorder prevents shortcut clashes with Ctrl+W. Checks a newly recorded keyboard shortcut against browser and OS reserved keys and the app's own bindings before it's saved. Catches: Combos the browser or OS keeps for itself, blocked from saving, Clashes with the app's existing bindings, naming the action, Keys that need AltGr on some keyboard layouts, Read-back for both Mac and Windows/Linux. Limitation: validate shortcut-recorder schemas on backend.

How do I install shortcut-recorder with shadcn?

Run `npx shadcn@latest add @bollard/shortcut-recorder`. Sources added: registry/default/shortcut-recorder/shortcut-recorder.tsx, registry/default/shortcut-recorder/shortcut-rules.ts. Package requirements: lucide-react.

What props customize Shortcut Recorder?

Shortcut Recorder accepts `label`, `value`, `defaultValue`, `onValueChange`, `bindings`. Configures keyboard shortcut, hotkey, keybinding behavior. Limitation: invalid prop values fallback to safe default options.

What are the limits of shortcut-recorder?

The reserved list covers common browsers and OSes; extensions and custom OS shortcuts are unknown. Layout warnings are heuristic Server requirement: backend verification for shortcut-recorder.

How does Shortcut Recorder meet accessibility guidelines?

Recorder is a button with aria-pressed while recording, labelled and described by its status. Tab or Escape (with no modifiers) stops recording; Backspace/Delete clears. Status in a polite live region; blocking issues use role=alert. Clear button has an aria-label. Minimizes errors: keyboard shortcut conflict, hotkey recorder.

Which components pair with Shortcut Recorder?