Keyboard

A Mac-style keyboard with real keycap depth, spring presses and synthesised switch sounds by key type, plus a live keystroke row, shortcut glows and auto-typing.

v0

Installation

Full Setup guide

Install the component automatically via Shadcn CLI.

npx shadcn@latest add https://www.grettech.com/api/registry/keyboard

Other Examples

Shortcut Hint

v0

Props

PropTypeDefaultDescription
sound
booleanfalseMechanical key sounds, made in the browser. They start after the visitor's first press.
volume
number0.6Loudness of the sounds, from 0 to 1.
switchType
"tactile" | "clicky" | "linear" | "thock""tactile"How the switches sound: tactile (a soft bump), clicky (a sharp snap), linear (quiet and smooth) or thock (deep and muted). Each kind of key sounds a little different, and long keys rattle on their stabilisers.
tilt
number0Tilt the keyboard back, in degrees, as if it sat on a desk.
listen
booleantrueLight up keys as they're typed on a real keyboard, while the keyboard is on screen.
showPreview
booleanfalseA row of the last keys pressed, above the keyboard.
highlight
string[]-Key codes to glow, such as a shortcut: ["MetaLeft", "KeyK"]. Uses KeyboardEvent.code names.
autoType
string-A phrase the keyboard can type by itself. When it types depends on typing.
typing
"idle" | "auto" | "user""idle"Who types. idle: the keyboard types autoType while nobody is using it, and hands over the moment someone hovers or types. auto: it keeps typing whatever the visitor does. user: only the visitor types; auto-typing is off.
idleDelay
number4Seconds without any interaction before auto-typing picks up again (idle mode).
accentColor
string"#6366f1"Colour of highlighted keys.
onKeyPress
(code: string) => void-Called with the key code of every key pressed, so it can work as an input.
className
string-Extra classes for the wrapper; set a max width to size it.