Keyboard Shortcuts
Keyboard Shortcuts is a React cheat sheet dialog of grouped shortcuts opened with the ? key or a button, searchable, with Command glyphs on Mac and Ctrl elsewhere.
src/registry/ui/keyboard-shortcuts.tsx/r/keyboard-shortcuts.json
Installation#
bash
npx shadcn@latest add @minidev/keyboard-shortcuts
MiniDev UI is in the shadcn registry directory, so the short form works with no setup. Older CLI versions can use the full URL: npx shadcn@latest add https://ui.minidev.pro/r/keyboard-shortcuts.json
Usage#
tsx
import { KeyboardShortcuts } from "@/components/ui/keyboard-shortcuts"
export function Example() {
return <KeyboardShortcuts />
}
API reference#
| Prop | Type | Default |
|---|---|---|
groups | KeyboardShortcutGroup[] | SAMPLE_GROUPS |
title | string | "Keyboard shortcuts" |
hotkey | string | "?" |
open | boolean | - |
onOpenChange | (open: boolean) => void | - |
showTrigger | boolean | true |
triggerLabel | string | "Keyboard shortcuts" |
className | string | - |
Dependencies#
Related overlays components#
Alert DialogShadcn style alert dialog on Base UI for confirmations that need an explicit answer. Modal backdrop, focus trap, title, description and an actions row.Command DialogCommand dialog that opens the command palette in a modal from a list of commands with labels and handlers. Wire it to a Cmd K shortcut in your React app.Confirm DestructiveDestructive action confirm: a red trigger button opens a dialog with a title, warning text, Cancel and Confirm. Labels are configurable for deletes and resets.Context MenuRight click context menu that opens at the cursor with menu items, including destructive items in red. Closes on selection or click outside, in React.DialogShadcn compatible modal dialog on Base UI with a blurred backdrop, enter and exit animation, close button, header, title, description and a footer bar.DrawerBottom drawer that slides a sheet up from the screen edge with a titled header, close button and scrolling body, capped at 80% of the viewport height.
All dialog, drawer and popover components