Skip to content

Kbd

Keyboard key + shortcut renderer. Platform-aware `mod` glyph, built-in modifier/arrow/enter aliases, outlined + soft variants.

Data Display·Available inReactVueAngular·View as Markdown

Preview

tsx
Esc

Switch the framework picker (top-right of the panel) to render the same demo live in React, Vue, or Angular — same class names, ARIA, and visual output across all three.

Installation

Sisyphos UI ships unified packages for React, Vue, and Angular. Pick the one that matches your stack — every framework exports the same component classes, ARIA semantics, and CSS tokens.

$ pnpm add @sisyphos-ui/react

Then import the bundled stylesheet once at app entry: import "@sisyphos-ui/react/styles.css";

Usage

Idiomatic usage in each supported framework
import { Kbd } from "@sisyphos-ui/react";

export const QuickOpen = () => <Kbd shortcut="cmd+k" />;

Shortcut string

Parsed on `+` and whitespace. Modifier aliases (`cmd`, `ctrl`, `shift`, …) map to glyphs; `mod` resolves to ⌘ on macOS and ⌃ elsewhere.

tsx
KPS

Visible separator

`separator` accepts any `ReactNode` — a plus, a dot, a custom divider — rendered between each key.

tsx
KP

Variants

`outlined` (default) has a border and light shadow; `soft` sits on a muted fill.

tsx
KK

Sizes

Scales via font-size; chip padding follows in `em`.

tsx
KKKKK

In prose

Drop `<Kbd>` into a paragraph — `vertical-align: middle` keeps it on the text baseline.

tsx

Press K to open the command menu, or Esc to dismiss it.

API

PropTypeDefaultDescription
variant"outlined" | "soft""outlined"Chip style.
size"xs" | "sm" | "md" | "lg" | "xl""sm"Size scale.
childrenReactNodeFree-form content; rendered inside a single `<kbd>`.
keysstring[]Explicit list of keys. Aliases normalized to glyphs.
shortcutstringShortcut string split on `+` and whitespace (e.g. `"cmd+k"`).
separatorReactNodeRendered between keys. Omit to join them visually.

The full API including refs, ARIA attributes, and HTML passthroughs lives in the package README on npm.

Need more?View on npm →
Was this page helpful?