For the complete documentation index, see llms.txt. Markdown variants are available by appending .md to any URL or sending an Accept: text/markdown header. The asciicn agent skill, for building any ASCII effect on the engine, is at /.well-known/agent-skills/asciicn/SKILL.md.

Keyboard shortcut

Keyboard shortcuts drawn as box-drawing keycaps, with Mac and PC labels and caps that press down while the visitor holds the keys.

Controls
Shortcut
Variant
Platform
Size
Press with the keyboard

Installation

pnpm dlx shadcn@latest add https://asciicn.dev/r/kbd-shortcut.json

Usage

import { KbdShortcut } from "@/components/asciicn/kbd-shortcut";
 
export function PaletteHint() {
  return <KbdShortcut keys="mod+shift+p" />;
}

keys is the shortcut as text. Join the keys of a chord with +, and separate steps with a space: "g i" draws G then I. Write ++ or a lone + for the plus key.

mod is ⌘ on a Mac and Ctrl elsewhere. Other names: ctrl, alt (or option), shift, meta (or cmd), enter, esc, tab, space, backspace, delete and the arrows up, down, left and right. Anything else is shown as written, with single letters in capitals.

On a Mac the caps show symbols, ⌘ ⇧ P. On a PC they show words joined by +, Ctrl + Shift + P. platform="auto" picks from the visitor's browser after the page loads; set "mac" or "pc" to fix it.

A cap keycap is three rows of box-drawing glyphs with a heavy bottom edge for depth:

┌─────┐ ┌───┐ ┌───┐
│  ⌘  │ │ ⇧ │ │ P │
┕━━━━━┙ ┕━━━┙ ┕━━━┙

With listen, a cap presses down while the visitor holds its key: the bottom edge goes flat and the label turns to reverse video. onTrigger runs each time the whole chord goes down.

variant="inline" sets each key in brackets on one row, [⌘] [K], to sit inside menus and running text.

Examples

Inline shortcuts aligned to the right of each action.

Cheat sheet

Keycaps in grey, in two groups.

Props

PropTypeDefault
keys*

The shortcut: + joins a chord, a space separates steps, as in "mod+shift+p" or "g i".

Type: stringDefault –
variant

Three-row keycaps, or keys in brackets on one row.

Type: "cap" | "inline"Default "cap"
platform

Mac symbols or PC words. auto reads the visitor's platform.

Type: "auto" | "mac" | "pc"Default "auto"
listen

Press the caps down while the visitor holds those keys.

Type: booleanDefault false
onTrigger

With listen, called once each time the whole chord goes down. One-step shortcuts only.

Type: () => voidDefault –
color

Label colour, a palette name or any CSS colour. The frame uses it at 55%.

Type: AsciiColorDefault "ink"
size

Glyph cell height: 12, 16 or 20px.

Type: "sm" | "md" | "lg"Default "md"
cell

Glyph cell height in CSS pixels. Overrides size.

Type: numberDefault –

Notes

  • The root and each key are <kbd> elements, as HTML nests them for a key combination. Box-drawing glyphs are hidden from screen readers, and each symbol has a spoken name, so ⌘ reads as "Command".
  • listen only watches the keyboard; it never stops the browser or the page from handling a shortcut. Pair it with your own handler.
  • The server renders PC labels. On a Mac, platform="auto" swaps in the symbols right after hydration.
  • Pressing is instant, with no animation, because it answers the visitor's own keys.