# Kbd

A keyboard key or shortcut on the real `<kbd>` element, the one HTML element that means "input from a keyboard". A combination follows the HTML spec's own pattern: an outer `<kbd>` holding one nested `<kbd>` per key, with the separator as real text between them, so a screen reader hears "Command plus K" as one shortcut rather than a row of unrelated glyphs.

## Platform-aware keys

The lowercase aliases `mod`, `alt`, `shift` and `ctrl` resolve per platform: `mod` is ⌘ on Apple platforms and Ctrl everywhere else. They render as text, not icons, so they inherit the font and scale with it. With `platform="auto"` (the default) the platform is read after hydration; the server and the first client render use the non-Apple names, so the markup always matches. Pass `platform="apple"` or `"other"` to pin it.

Symbol keys (⌘ ⌥ ⇧ ⌃, ↵, the arrows) get a visually hidden spoken name, because screen readers announce those glyphs inconsistently.

## Examples

### Single key

Children render as one key.

### Combination

One nested key per entry in keys.

### Inline

Sized like Badge, it sits on the text baseline.

Press `Ctrl+↵Enter` to send.

## Playground

Toggle every adjustable prop and watch the component — and the code — update live.

## Props

| Prop | Type | Default |
| --- | --- | --- |
| `keys` | string[] | — |
| `separator` | ReactNode | "+" |
| `platform` | "auto" \| "apple" \| "other" | "auto" |
| `children` | ReactNode (a single key, when `keys` is omitted) | — |

The custom element takes `keys` as a space-separated attribute: `<kernel-kbd keys="mod shift P">`.

## Accessibility

- `<kbd>` is the semantic element for keyboard input; nesting follows the HTML spec's example for combinations.
- The separator is real text, so the combination is read as one phrase.
- Modifier symbols are `aria-hidden` and paired with a visually hidden name ("Command", "Shift", "Enter").
