Skip to content
shadcn.io

shadcn.io is not affiliated with official shadcn/ui

Keyboard Shortcut Card Features Block for React

A shortcut cheat sheet for a shortcut trainer: two groups of four shortcuts in one framed card, where pressing a shortcut while the card is focused lights its row.

Framework
UI library

Preview

Preview width

Installation

Part of Pro
Pro unlocks the code and one-line install of every Pro button and text effect, plus the MCP for your AI editor.
Have Pro already? Sign in to open it.Opens here as soon as you're Pro.

Overview

A shortcut cheat sheet for React with Base UI. Two groups, "Move around" and "Edit text", each a keyboard table of four shortcuts with real key caps, sit in one hairline frame with + marks on its corners, divided by a hairline from md. Click the card (or tab to it) and press one of the shortcuts: its row lights up and a status line says what was pressed. A hint under the table says so, and notes that the Command key is Control on Windows and Linux. The page's rails and top rule come from the Guides spine. It's built from the Keyboard Table, Kbd and Guides, with your theme's tokens for every colour. For editors, developer tools and trainers where the keys are the product.

FAQ

How do I change the shortcuts?

Edit GROUPS at the top of the file. Each shortcut has the keys shown as key caps, the key to match (match, the value of KeyboardEvent.key in lower case), and flags for mod, shift and alt. mod means Command on a Mac or Control elsewhere, so one entry works on both.

When does it read the keys?

Only while the card has focus: it is a tab stop with a visible focus ring, and its key handler is on the card, not on the page. A shortcut that matches is stopped from reaching the browser (so Control or Command with K does not open the browser's own search while the card is focused), and a key that matches nothing is left alone. Moving focus out of the card clears the highlight.

What do screen readers get?

The card is named "Shortcut sheet. Press a shortcut to highlight it.", each group has a heading, and each table is a real table whose key cell reads as its keys joined with plus, for example "Command plus K". The line under the table is a polite live region that says which shortcut was pressed.

Why does it show the Command symbol on a PC?

The key caps are the Mac ones, and the hint under the table says Control stands in for Command on Windows and Linux. The handler accepts either key, so pressing Control with K works on a PC and Command with K on a Mac.

What happens on a phone?

The two groups stack, one under the other, and the hint and status line are left out, because there is no keyboard to press them. The tables still read as a reference sheet.

Does anything animate?

The card fades up once when the page loads and a lit row changes colour with a short transition. With reduced motion both are off and the card simply appears.

  • Pro

    A six-cell feature grid for a keyboard-first notes app: one focus ring glides between cells with the arrow keys, and Enter or a tap writes the cell's detail into a strip under the grid.

  • Pro

    A live command menu for a workflow launcher: a search field that filters nine actions in three groups, with a preview pane that shows what the highlighted action will do.

  • Pro

    A centred card-in-card call to action built around a keyboard shortcut: three key caps in a hairline frame that press down as the keys do and open a filterable command palette, which the Shine Button opens too.

  • Pro

    A dock of eight tool tiles that grow with their distance from the pointer, under a detail card that follows the active tile, built on tabs so the arrow keys and a tap work too.

  • Pro

    A board of six vertical sliders for an alert-tuning tool, each with a level meter and a readout, and a composite readout of pages a week and incidents caught worked out from the six settings.

  • Pro

    A Before and After control that cross-fades a settings screen between a cluttered version (warning banners, a nested menu, badges everywhere) and a clean one, in a frame that never changes height.