Skip to content
Alea0.1
Pro
  1. Alea
  2. Components
  3. Overlays
  4. KeyboardShortcuts

Overlays

KeyboardShortcuts

Every keyboard shortcut of an app in one searchable dialog, opened with "?" from anywhere. The main modifier shows as the key of each system (⌘ or Ctrl), and sequences read as "G then I".

import { KeyboardShortcuts } from '@alea/ui';

Examples

Shortcuts

Press ? anywhere on this page (outside a text field), or the button. Search by what a shortcut does; "mod" shows as the main modifier of each system (⌘ or Ctrl).

Tokens

The design tokens this component reads, with their value in the current theme. Override any of them to restyle it.

Color

  • --alea-border…
  • --alea-text-muted…

Space

  • --alea-space-2…
  • --alea-space-3…
  • --alea-space-6…
  • --alea-space-8…

Type

  • --alea-font-family-body…
  • --alea-font-size-sm…
  • --alea-font-size-xs…
  • --alea-font-weight-semibold…

Props

KeyboardShortcuts props

Every keyboard shortcut of an app in one searchable dialog, opened with "?" from anywhere. The main modifier shows as each system's own key (⌘ or Ctrl); sequences ("G then I") read as such.

PropTypeDefaultDescription
groupsrequired{ title: string; shortcuts: Shortcut[]; }[]-The shortcuts in groups: Navigation, Actions, Editing.
isOpenboolean-Open (controlled). Leave out and pass openKey to open it from the keyboard.
onOpenChange((open: boolean) => void)-Called when it opens or closes.
openKeystring | false'?'A key that opens it from anywhere (outside text fields). Default "?".
titleReactNode-The title. Default "Keyboard shortcuts".
triggerReactNode-A button that opens it.

Specs

Generated from the source: the variants in the types, the states and tokens in the CSS, and the motion patterns that apply. The grids render the real component in both themes; the numbers are measured from the page.

Dark and light
Every color comes from theme tokens, so it follows data-theme (and presets like Graphite) on the page or any wrapper. Contrast is checked in both themes.
Styling hooks
.alea-kbs-empty.alea-kbs.alea-kbs-group.alea-kbs-title.alea-kbs-list.alea-kbs-row.alea-kbs-combo.alea-kbs-then.alea-kbd

Accessibility

  • A modal dialog with a title; the search field gets focus when it opens.
  • Each shortcut is a description term (what it does) and its keys, so screen readers read "Search, Command K".
  • "?" opens it only outside text fields, so typing a question mark in a form never opens it.

Keyboard

KeyDoes
?Opens it from anywhere outside a text field
EscapeCloses it

Do and don't

Do

  • Group shortcuts the way the app is organized: Navigation, Actions, Editing.
  • Use "mod" for the main modifier so each platform sees its own key.

Don't

  • Don't list shortcuts that are not wired.
  • Don't take over keys the browser or screen readers use.

In Figma

KeyboardShortcuts as a dialog with groups of rows and key caps.

Tested with axe, keyboard and screen reader roles