Desk accessories · component · 16K
An on-screen keyboard in the spirit of the Key Caps desk accessory: a compact ANSI keyboard with square keycaps that invert while the physical keys are held, Shift and Option layers, a text field that shows what you type, and highlighted shortcuts.
Listens on window keydown/keyup by KeyboardEvent.code only while mounted and listening (default true). highlight={["⌘K", { keys: "⇧⌘P", label: "Command palette" }]} marks keys with a heavy frame and lists the shortcuts as text; the drawn keyboard itself is aria-hidden. With typeAnywhere (default) keys typed while nothing else has focus go into the field. Legends follow a US layout; override any of them per layer through layout.
pnpm dlx shadcn@latest add @s7ui/keyboard-viewerThis example also uses @s7ui/window.