Staaarter

Keyboard Shortcuts Reference

A grouped keyboard shortcuts section, organized into columns like General, Navigation, and Editing. Each shortcut pairs an action description with a cluster of keycap-styled <kbd> elements joined by a plus sign for combos. Built for docs pages, onboarding screens, and app help panels.

By Staaarter Team
DevTools
Docs
Live preview

Docs

Installation

A real shadcn registry command, not a copy-paste stand-in: it fetches this block plus its dependencies and any missing npm packages, and installs them straight into your project.

npx shadcn add https://staaarter.com/r/keyboard-shortcuts-reference.json

Prefer not to use the CLI? Copy the source from the Code toggle above into src/components/blocks/devtools/devtools4.tsx instead.

Usage

The file also exports devtools4Demo, the exact props behind the preview above. Spread it to get a working section in one line, then replace it with your own data.

import { Devtools4, devtools4Demo } from "@/components/blocks/devtools/devtools4";

export default function Page() {
  return <Devtools4 {...devtools4Demo} />;
}

Props

PropTypeDefaultDescription
headingstring"Keyboard Shortcuts"Section heading.
descriptionstringundefinedSection intro text below the heading.
groupsShortcutGroup[][]Shortcut groups, each rendered as its own column.
classNamestringnoneExtra classes for the outer section element.

Types

type ShortcutItem = { action: string; keys: string[] };

type ShortcutGroup = { title: string; shortcuts: ShortcutItem[] };

Behavior notes

  • Entirely static; no client-side interactivity, and pressing the displayed keys does nothing on the page itself.
  • Groups render in a fixed 2-column grid on sm and above and stack to a single column below that; the grid does not adapt column count to the number of groups.
  • Each key in a combo is its own <kbd> element with a "+" separator between them; there is no limit enforced on how many keys a combo can list, though 2-3 keeps the row readable.
  • The keycap look (bordered, shadow, bg-muted) is achieved with a plain box-shadow utility, not a real 3D or pressable interaction.