Shortcut overlay

Modal showing all registered keyboard shortcuts, triggered by pressing ?.

Install

npx shadcn@latest add https://substrate.georgedrury.co.uk/r/shortcut-overlay

Examples

Default

"use client"

import { useState } from "react"

Props

PropTypeDefaultDescription
groupsShortcutGroup[]—Groups of shortcuts to display
openboolean—Controlled open state
onOpenChange(open: boolean) => void—Controlled open change handler
triggerstring"?"Key that toggles the overlay

ShortcutGroup

type ShortcutGroup = {
	heading: string
	shortcuts: { key: string; label: string }[]
}

The key string is split on + and each part rendered as an individual <kbd>. For example "⌘ + Z" renders as two separate key badges.

Components

ComponentDescription
ShortcutOverlayDialog modal with ? key listener
ShortcutKeyInline keyboard shortcut badge (reusable standalone)