# Kbd

A key in a hairline box, and ShortcutHint, the platform's modifier and a key pushed to the end of a menu row: ⌘ on Apple devices, Ctrl elsewhere.

- Beta: ready to use; its API can still change in a minor release.
- Category: Status & indicators

```tsx
import { Kbd, ShortcutHint } from "@leap-crm/design-system";
```

## Best practices

- Do: Use `ShortcutHint` at the end of a menu row for a modifier shortcut, like opening search. It shows ⌘ on Apple devices and Ctrl elsewhere.
- Do: Put each key in its own `Kbd`, like ⌘ then K, so the reader sees how many keys to press.
- Don't: Write ⌘ or Ctrl by hand for a modifier shortcut. Half the firm would read the wrong key; `ShortcutHint` picks the platform's.
- Don't: Make a shortcut the only way to an action. Put the action in a menu or button too, so it works by pointer and touch.

## Related

- [Tooltip](./tooltip.md)
- [Dropdown Menu](./dropdown-menu.md)

## Examples

What the examples import:

```tsx
import { Kbd, ShortcutHint } from "@leap-crm/design-system";
```

### Keys

11 px at 450 in muted text, 1 px border, 4 px radius.

```tsx
<div className="flex items-center gap-2">
  <Kbd>⌘</Kbd>
  <Kbd>Ctrl</Kbd>
  <Kbd>K</Kbd>
  <Kbd>Enter</Kbd>
  <Kbd>Esc</Kbd>
</div>
```

### In a menu row

```tsx
<div className="text-body text-neutral-text flex w-64 items-center rounded-md px-2 py-1.5">
  Search
  <ShortcutHint chord="K" />
</div>
```

## Props

### Kbd

| Prop | Type | Default | Description |
| --- | --- | --- | --- |
| `children` (required) | `ReactNode` |  | What it shows inside. |
| `className` | `string` |  | Classes added to the root element, merged with its own. Tokens only. |

### ShortcutHint

| Prop | Type | Default | Description |
| --- | --- | --- | --- |
| `chord` (required) | `string` |  | The key pressed with the modifier, like "K". |
| `className` | `string` |  | Classes added to the root element, merged with its own. Tokens only. |
