Kbd

Keyboard key chips and key combos that render ⌘ or Ctrl for the visitor's platform without hydration mismatch, in two sizes, with a spring dip when pressed and an optional listen mode that animates each key as the real one is held.

Preview

Kbd preview width

Install

Add it with the shadcn CLI, or copy the source manually.

$ bunx --bun shadcn add @karaui/kbd
@karaui not found? Add it to components.json
{
  "registries": {
    "@karaui": "https://karaui.kamisama-v0.my.id/r/{name}.json"
  }
}

@karaui is in shadcn's public registry directory, so the latest CLI needs no setup. On an older CLI, merge this into the existing file once and every @karaui/… install resolves.

API Reference

Kbd

children
ReactNode

A key token ("mod", "shift", "k", "enter"…) or any custom content.

—
size?
"sm" | "md"
md
pressed?
boolean

Show the key pressed (spring dip).

false
listen?
boolean

Dip when the real key is held. Needs `children` to be a key token string.

false
className?
string
—

KbdCombo

keys
string[]

Key tokens, e.g. ["mod", "shift", "p"].

—
size?
"sm" | "md"
md
pressed?
boolean

Show every key pressed.

false
listen?
boolean

Dip each key while the real key is held.

false
separator?
ReactNode

Text between keys. Default none on Apple, "+" elsewhere.

—
className?
string
—

Updated